浏览代码

Merge pull request #15 from wenzhixin/master

Update my repo
Dennis Hernández 11 年之前
父节点
当前提交
6c271fe189

+ 4 - 0
README.md

@@ -79,3 +79,7 @@ grunt build
 ```
 ```
 
 
 Result will appear in `dist` directory.
 Result will appear in `dist` directory.
+
+
+[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/wenzhixin/bootstrap-table/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
+

文件差异内容过多而无法显示
+ 7 - 0
dist/locale/bootstrap-table-nb-NO.min.js


文件差异内容过多而无法显示
+ 7 - 0
docs/dist/locale/bootstrap-table-nb-NO.min.js


+ 6 - 9
src/bootstrap-table.js

@@ -474,7 +474,7 @@
         if (type === 'append') {
         if (type === 'append') {
             this.data = this.data.concat(data);
             this.data = this.data.concat(data);
         } else if (type === 'prepend') {
         } else if (type === 'prepend') {
-            this.data = data.concat(this.data);
+            this.data = [].concat(data).concat(this.data);
         } else {
         } else {
             this.data = data || this.options.data;
             this.data = data || this.options.data;
         }
         }
@@ -854,7 +854,7 @@
             }
             }
         }
         }
         for (i = from; i <= to; i++) {
         for (i = from; i <= to; i++) {
-            html.push('<li class="page-number' + (i === this.options.pageNumber ? ' active disabled' : '') + '">',
+            html.push('<li class="page-number' + (i === this.options.pageNumber ? ' active' : '') + '">',
                 '<a href="javascript:void(0)">', i ,'</a>',
                 '<a href="javascript:void(0)">', i ,'</a>',
                 '</li>');
                 '</li>');
         }
         }
@@ -1049,15 +1049,11 @@
                 }
                 }
 
 
                 if (column.checkbox || column.radio) {
                 if (column.checkbox || column.radio) {
-                    //if card view mode bypass
-                    if (that.options.cardView) {
-                        return true;
-                    }
-
                     type = column.checkbox ? 'checkbox' : type;
                     type = column.checkbox ? 'checkbox' : type;
                     type = column.radio ? 'radio' : type;
                     type = column.radio ? 'radio' : type;
 
 
-                    text = ['<td class="bs-checkbox">',
+                    text = [that.options.cardView ?
+                        '<div class="card-view">' : '<td class="bs-checkbox">',
                         '<input' +
                         '<input' +
                             sprintf(' data-index="%s"', i) +
                             sprintf(' data-index="%s"', i) +
                             sprintf(' name="%s"', that.options.selectItemName) +
                             sprintf(' name="%s"', that.options.selectItemName) +
@@ -1068,7 +1064,7 @@
                             sprintf(' disabled="%s"', !column.checkboxEnabled ||
                             sprintf(' disabled="%s"', !column.checkboxEnabled ||
                                 (value && value.disabled) ? 'disabled' : undefined) +
                                 (value && value.disabled) ? 'disabled' : undefined) +
                             ' />',
                             ' />',
-                        '</td>'].join('');
+                        that.options.cardView ? '</div>' : '</td>'].join('');
                 } else {
                 } else {
                     value = typeof value === 'undefined' || value === null ?
                     value = typeof value === 'undefined' || value === null ?
                         that.options.undefinedText : value;
                         that.options.undefinedText : value;
@@ -1533,6 +1529,7 @@
         this.$selectItem.filter(sprintf('[data-index="%s"]', index)).prop('checked', checked);
         this.$selectItem.filter(sprintf('[data-index="%s"]', index)).prop('checked', checked);
         this.data[index][this.header.stateField] = checked;
         this.data[index][this.header.stateField] = checked;
         this.updateSelected();
         this.updateSelected();
+        this.trigger(checked ? 'check' : 'uncheck', this.data[index]);
     };
     };
 
 
     BootstrapTable.prototype.destroy = function () {
     BootstrapTable.prototype.destroy = function () {

+ 2 - 1
src/extensions/editable/bootstrap-table-editable.js

@@ -42,7 +42,8 @@
                 return ['<a href="javascript:void(0)"',
                 return ['<a href="javascript:void(0)"',
                     ' data-name="' + column.field + '"',
                     ' data-name="' + column.field + '"',
                     ' data-pk="' + row[that.options.idField] + '"',
                     ' data-pk="' + row[that.options.idField] + '"',
-                    '>' + result + '</a>'
+                    ' data-value="' + result + '"',
+                    '>' + '</a>'
                 ].join('');
                 ].join('');
             };
             };
         });
         });

+ 32 - 0
src/extensions/sorting/bootstrap-table_natural-sorting.js

@@ -0,0 +1,32 @@
+//JS function to allow natural sorting on bootstrap-table columns
+//just add data-sorter="alphanum" to any th
+//Thanks to Brian Huisman: http://www.greywyvern.com
+
+function alphanum(a, b) {
+  function chunkify(t) {
+    var tz = [], x = 0, y = -1, n = 0, i, j;
+
+    while (i = (j = t.charAt(x++)).charCodeAt(0)) {
+      var m = (i == 46 || (i >=48 && i <= 57));
+      if (m !== n) {
+        tz[++y] = "";
+        n = m;
+      }
+      tz[y] += j;
+    }
+    return tz;
+  }
+
+  var aa = chunkify(a);
+  var bb = chunkify(b);
+
+  for (x = 0; aa[x] && bb[x]; x++) {
+    if (aa[x] !== bb[x]) {
+      var c = Number(aa[x]), d = Number(bb[x]);
+      if (c == aa[x] && d == bb[x]) {
+        return c - d;
+      } else return (aa[x] > bb[x]) ? 1 : -1;
+    }
+  }
+  return aa.length - bb.length;
+}

+ 40 - 0
src/locale/bootstrap-table-ar-SA.js

@@ -0,0 +1,40 @@
+/**
+ * Bootstrap Table English translation
+ * Author: Zhixin Wen<wenzhixin2010@gmail.com>
+ */
+(function ($) {
+    'use strict';
+
+    $.fn.bootstrapTable.locales['ar-SA'] = {
+        formatLoadingMessage: function () {
+            return 'جاري التحميل, يرجى الإنتظار...';
+        },
+        formatRecordsPerPage: function (pageNumber) {
+            return pageNumber + ' سجل لكل صفحة';
+        },
+        formatShowingRows: function (pageFrom, pageTo, totalRows) {
+            return 'الظاهر ' + pageFrom + ' إلى ' + pageTo + ' من ' + totalRows + ' سجل';
+        },
+        formatSearch: function () {
+            return 'بحث';
+        },
+        formatNoMatches: function () {
+            return 'لا توجد نتائج مطابقة للبحث';
+        },
+        formatPaginationSwitch: function () {
+            return 'إخفاء\إظهار ترقيم الصفحات';
+        },
+        formatRefresh: function () {
+            return 'تحديث';
+        },
+        formatToggle: function () {
+            return 'تغيير';
+        },
+        formatColumns: function () {
+            return 'أعمدة';
+        }
+    };
+
+    $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['ar-SA']);
+
+})(jQuery);

+ 29 - 0
src/locale/bootstrap-table-es-MX.js

@@ -0,0 +1,29 @@
+/**
+ * Bootstrap Table Spanish (México) translation (Obtenido de traducción de Argentina)
+ * Author: Felix Vera (felix.vera@gmail.com) 
+ * Copiado: Mauricio Vera (mauricioa.vera@gmail.com)
+ */
+(function ($) {
+    'use strict';
+
+    $.fn.bootstrapTable.locales['es-MX'] = {
+        formatLoadingMessage: function () {
+            return 'Cargando, espere por favor...';
+        },
+        formatRecordsPerPage: function (pageNumber) {
+            return pageNumber + ' registros por página';
+        },
+        formatShowingRows: function (pageFrom, pageTo, totalRows) {
+            return 'Mostrando ' + pageFrom + ' a ' + pageTo + ' de ' + totalRows + ' filas';
+        },
+        formatSearch: function () {
+            return 'Buscar';
+        },
+        formatNoMatches: function () {
+            return 'No se encontraron registros';
+        }
+    };
+
+    $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['es-MX']);
+
+})(jQuery);

+ 37 - 0
src/locale/bootstrap-table-nb-NO.js

@@ -0,0 +1,37 @@
+/**
+ * Bootstrap Table norwegian translation
+ * Author: Jim Nordbø, jim@nordb.no
+ */
+(function ($) {
+    'use strict';
+
+    $.fn.bootstrapTable.locales['nb-NO'] = {
+        formatLoadingMessage: function () {
+            return 'Oppdaterer, vennligst vent...';
+        },
+        formatRecordsPerPage: function (pageNumber) {
+            return pageNumber + ' poster pr side';
+        },
+        formatShowingRows: function (pageFrom, pageTo, totalRows) {
+            return 'Viser ' + pageFrom + ' til ' + pageTo + ' av ' + totalRows + ' rekker';
+        },
+        formatSearch: function () {
+            return 'Søk'
+        },
+        formatNoMatches: function () {
+            return 'Ingen poster funnet';
+        },
+        formatRefresh: function () {
+            return 'Oppdater';
+        },
+        formatToggle: function () {
+            return 'Endre';
+        },
+        formatColumns: function () {
+            return 'Kolonner';
+        }
+    };
+
+    $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['nb-NO']);
+
+})(jQuery);