ソースを参照

Merge branch 'develop' of https://github.com/wenzhixin/bootstrap-table into add-titles-to-pagination

Jonathan Goode 10 年 前
コミット
fc7ed041ea

+ 1 - 0
.gitignore

@@ -1,4 +1,5 @@
 node_modules
+bower_components
 
 # docs site
 _gh_pages

+ 1 - 2
src/bootstrap-table.js

@@ -790,8 +790,7 @@
         }
 
         this.$selectAll = this.$header.find('[name="btSelectAll"]');
-        this.$container.off('click', '[name="btSelectAll"]')
-            .on('click', '[name="btSelectAll"]', function () {
+        this.$selectAll.off('click').on('click', function () {
                 var checked = $(this).prop('checked');
                 that[checked ? 'checkAll' : 'uncheckAll']();
                 that.updateSelected();

+ 3 - 0
src/extensions/export/README.md

@@ -33,3 +33,6 @@ Use Plugin: [tableExport.jquery.plugin](https://github.com/hhurz/tableExport.jqu
 * type: Object
 * description: export [options](https://github.com/hhurz/tableExport.jquery.plugin#options) of `tableExport.jquery.plugin`
 * default: `{}`
+
+### Icons
+* export: 'glyphicon-export icon-share'

+ 6 - 1
src/extensions/export/bootstrap-table-export.js

@@ -5,6 +5,7 @@
 
 (function ($) {
     'use strict';
+    var sprintf = $.fn.bootstrapTable.utils.sprintf;
 
     var TYPE_NAME = {
         json: 'JSON',
@@ -27,6 +28,10 @@
         exportOptions: {}
     });
 
+    $.extend($.fn.bootstrapTable.defaults.icons, {
+        export: 'glyphicon-export icon-share'
+    });
+
     var BootstrapTable = $.fn.bootstrapTable.Constructor,
         _initToolbar = BootstrapTable.prototype.initToolbar;
 
@@ -45,7 +50,7 @@
                     '<div class="export btn-group">',
                         '<button class="btn btn-default dropdown-toggle" ' +
                             'data-toggle="dropdown" type="button">',
-                            '<i class="glyphicon glyphicon-export icon-share"></i> ',
+                            sprintf('<i class="%s %s"></i> ', this.options.iconsPrefix, this.options.icons.export),
                             '<span class="caret"></span>',
                         '</button>',
                         '<ul class="dropdown-menu" role="menu">',

+ 3 - 0
src/extensions/filter-control/README.md

@@ -42,6 +42,9 @@ Dependence if you use the datepicker option: [bootstrap-datepicker](https://gith
 * description: Set to true if you want to use the strict search mode.
 * default: `false`
 
+### Icons
+* clear: 'glyphicon-trash icon-clear'
+
 ## Events
 
 ### onColumnSearch(column-search.bs.table)

+ 4 - 1
src/extensions/filter-control/bootstrap-table-filter-control.js

@@ -9,6 +9,9 @@
     'use strict';
 
     var sprintf = $.fn.bootstrapTable.utils.sprintf;
+    $.extend($.fn.bootstrapTable.defaults.icons, {
+        clear: 'glyphicon-trash icon-clear'
+    });
 
     var addOptionToSelectControl = function (selectControl, value, text) {
         selectControl = $(selectControl.get(selectControl.length - 1));
@@ -304,7 +307,7 @@
               $btnClear = $([
                     '<button class="btn btn-default " ' +
                         'type="button">',
-                    '<i class="glyphicon glyphicon-trash icon-share"></i> ',
+                    sprintf('<i class="%s %s"></i> ', this.options.iconsPrefix, this.options.icons.clear),
                     '</button>',
                     '</ul>'].join('')).appendTo($btnGroup);
 

+ 16 - 2
src/extensions/natural-sorting/README.md

@@ -8,6 +8,20 @@ Use Plugin: [bootstrap-table-natural-sorting](https://github.com/wenzhixin/boots
 <script src="extensions/natural-sorting/bootstrap-table-natural-sorting.js"></script>
 ```
 
-### Options
+add a data-sorter atribute to any th. 
+*e.g.* ``` <th data-sortable="true" data-sorter="alphanum">Price</th>```
+
+## Options
+
+### alphanum
+* sort alpha or numeric content naturally.
+* This can be used in columns that contain text or numeric content. 
+* Numbers will be sorted as expected and not in ASCII order 
+
+### numericOnly
+* extract numeric content and sort numerically.  
+* This can be used in columns that contain formated numeric content. 
+*  *e.g.* $ and , will be removed, then Numbers will be sorted as expected
+* an alpha sort crrently sorts these as ASCII so you get $1, $100, $2, $20
+  instead of $1, $2, $20, $100.
 
-* Just add data-sorter="alphanum" to any th

+ 12 - 2
src/extensions/natural-sorting/bootstrap-table-natural-sorting.js

@@ -2,10 +2,11 @@
  * @author: Brian Huisman
  * @webSite: http://www.greywyvern.com
  * @version: v1.0.0
- * JS function to allow natural sorting on bootstrap-table columns
- * just add data-sorter="alphanum" to any th
+ * JS functions to allow natural sorting on bootstrap-table columns
+ * add data-sorter="alphanum" or data-sorter="numericOnly" to any th
  *
  * @update Dennis Hernández <http://djhvscf.github.io/Blog>
+ * @update Duane May
  */
 
 function alphanum(a, b) {
@@ -44,4 +45,13 @@ function alphanum(a, b) {
     }
   }
   return aa.length - bb.length;
+}
+
+function numericOnly(a, b) {
+    function stripNonNumber(s) {
+        s = s.replace(new RegExp(/[^0-9]/g), "");
+        return parseInt(s, 10);
+    }
+
+    return stripNonNumber(a) - stripNonNumber(b);
 }

+ 7 - 6
src/locale/bootstrap-table-ca-ES.js

@@ -1,13 +1,14 @@
 /**
  * Bootstrap Table Catalan translation
- * Author: Marc Pina<iwalkalone69@gmail.com>
+ * Authors: Marc Pina<iwalkalone69@gmail.com>
+ *          Claudi Martinez<claudix.kernel@gmail.com>
  */
 (function ($) {
     'use strict';
 
     $.fn.bootstrapTable.locales['ca-ES'] = {
         formatLoadingMessage: function () {
-            return 'Si us plau esperi...';
+            return 'Espereu, si us plau...';
         },
         formatRecordsPerPage: function (pageNumber) {
             return pageNumber + ' resultats per pàgina';
@@ -16,19 +17,19 @@
             return 'Mostrant de ' + pageFrom + ' fins ' + pageTo + ' - total ' + totalRows + ' resultats';
         },
         formatSearch: function () {
-            return 'Buscar';
+            return 'Cerca';
         },
         formatNoMatches: function () {
             return 'No s\'han trobat resultats';
         },
         formatPaginationSwitch: function () {
-            return 'Amagar/Mostrar paginació';
+            return 'Amaga/Mostra paginació';
         },
         formatRefresh: function () {
-            return 'Refrescar';
+            return 'Refresca';
         },
         formatToggle: function () {
-            return 'Amagar/Mostrar';
+            return 'Alterna formatació';
         },
         formatColumns: function () {
             return 'Columnes';