Browse Source

Merge pull request #1875 from djhvscf/develop

Added extensions files
wenzhixin 10 years ago
parent
commit
00533e0410

+ 18 - 1
src/bootstrap-table.js

@@ -225,6 +225,10 @@
         return escape ? escapeHTML(value) : value;
         return escape ? escapeHTML(value) : value;
     };
     };
 
 
+    var isIEBrowser = function () {
+        return !!(navigator.userAgent.indexOf("MSIE ") > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./));
+    };
+
     // BOOTSTRAP TABLE CLASS DEFINITION
     // BOOTSTRAP TABLE CLASS DEFINITION
     // ======================
     // ======================
 
 
@@ -763,7 +767,11 @@
             $(this).data(visibleColumns[$(this).data('field')]);
             $(this).data(visibleColumns[$(this).data('field')]);
         });
         });
         this.$container.off('click', '.th-inner').on('click', '.th-inner', function (event) {
         this.$container.off('click', '.th-inner').on('click', '.th-inner', function (event) {
-            if (that.options.sortable && $(this).parent().data().sortable) {
+            var target = $(this);
+            if (target.closest('.bootstrap-table')[0] !== that.$container[0])
+                return false;
+
+            if (that.options.sortable && target.parent().data().sortable) {
                 that.onSort(event);
                 that.onSort(event);
             }
             }
         });
         });
@@ -1063,6 +1071,15 @@
                     that.onSearch(event);
                     that.onSearch(event);
                 }, that.options.searchTimeOut);
                 }, that.options.searchTimeOut);
             });
             });
+
+            if (isIEBrowser()) {
+                $search.off('mouseup').on('mouseup', function (event) {
+                    clearTimeout(timeoutId); // doesn't matter if it's 0
+                    timeoutId = setTimeout(function () {
+                        that.onSearch(event);
+                    }, that.options.searchTimeOut);
+                });
+            }
         }
         }
     };
     };
 
 

+ 4 - 4
src/extensions/filter-control/README.md

@@ -23,11 +23,11 @@ Dependence if you use the datepicker option: [bootstrap-datepicker](https://gith
 * description: Set true to add a button to clear all the controls added by this plugin
 * description: Set true to add a button to clear all the controls added by this plugin
 * default: `false`
 * default: `false`
 
 
-### filterLocal
+### alignmentSelectControlOptions
 
 
-* type: Boolean
-* description: Set false to disable local data filtering. This allows you to filter the data on server side when using remote data sources.
-* default: `true`
+* type: String
+* description: Set the alignemnt of the select control options. Use Use `left`, `right` or `auto`.
+* default: `undefined`
 
 
 ## Column options
 ## Column options
 
 

+ 24 - 7
src/extensions/filter-control/bootstrap-table-filter-control.js

@@ -150,7 +150,7 @@
                 if (column.searchable && that.options.filterTemplate[nameControl]) {
                 if (column.searchable && that.options.filterTemplate[nameControl]) {
                     addedFilterControl = true;
                     addedFilterControl = true;
                     isVisible = 'visible';
                     isVisible = 'visible';
-                    html.push(that.options.filterTemplate[nameControl](column.field, isVisible));
+                    html.push(that.options.filterTemplate[nameControl](that, column.field, isVisible));
                 }
                 }
             }
             }
 
 
@@ -240,23 +240,40 @@
         }
         }
     };
     };
 
 
+    var getDirectionOfSelectOptions = function (alignment) {
+        alignment = alignment === undefined ? 'left' : alignment.toLowerCase();
+
+        switch (alignment) {
+            case 'left':
+                return 'ltr';
+            case 'right':
+                return 'rtl';
+            case 'auto':
+                return 'auto';
+            default:
+                return 'ltr'
+        }
+    };
+
     $.extend($.fn.bootstrapTable.defaults, {
     $.extend($.fn.bootstrapTable.defaults, {
         filterControl: false,
         filterControl: false,
         onColumnSearch: function (field, text) {
         onColumnSearch: function (field, text) {
             return false;
             return false;
         },
         },
         filterShowClear: false,
         filterShowClear: false,
-        filterLocal: true,
+        alignmentSelectControlOptions: undefined,
         //internal variables
         //internal variables
         values: [],
         values: [],
+        that: this,
         filterTemplate: {
         filterTemplate: {
-            input: function (field, isVisible) {
+            input: function (that, field, isVisible) {
                 return sprintf('<input type="text" class="form-control %s" style="width: 100%; visibility: %s">', field, isVisible);
                 return sprintf('<input type="text" class="form-control %s" style="width: 100%; visibility: %s">', field, isVisible);
             },
             },
-            select: function (field, isVisible) {
-                return sprintf('<select class="%s form-control" style="width: 100%; visibility: %s"></select>', field, isVisible);
+            select: function (that, field, isVisible) {
+                return sprintf('<select class="%s form-control" style="width: 100%; visibility: %s" dir="%s"></select>',
+                    field, isVisible, getDirectionOfSelectOptions(that.options.alignmentSelectControlOptions))
             },
             },
-            datepicker: function (field, isVisible) {
+            datepicker: function (that, field, isVisible) {
                 return sprintf('<input type="text" class="date-filter-control %s form-control" style="width: 100%; visibility: %s">', field, isVisible);
                 return sprintf('<input type="text" class="date-filter-control %s form-control" style="width: 100%; visibility: %s">', field, isVisible);
             }
             }
         }
         }
@@ -384,7 +401,7 @@
     BootstrapTable.prototype.initSearch = function () {
     BootstrapTable.prototype.initSearch = function () {
         _initSearch.apply(this, Array.prototype.slice.apply(arguments));
         _initSearch.apply(this, Array.prototype.slice.apply(arguments));
 
 
-        if (! this.options.filterLocal) {
+        if (!this.options.sidePagination === 'server') {
             return;
             return;
         }
         }
 
 

+ 17 - 0
src/extensions/filter/extension.json

@@ -0,0 +1,17 @@
+{
+  "name": "Filter",
+  "version": "1.0.0",
+  "description": "Plugin to filter the boostrap table data.",
+  "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/filter",
+  "example": "#",
+
+  "plugins": [{
+    "name": "bootstrap-table-filter",
+    "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/filter"
+  }],
+
+  "author": {
+    "name": "wenzhixin",
+    "image": "https://avatars1.githubusercontent.com/u/2117018"
+  }
+}

+ 17 - 0
src/extensions/group-by/extension.json

@@ -0,0 +1,17 @@
+{
+  "name": "Group By",
+  "version": "1.1.0",
+  "description": "Plugin to group the data by fields.",
+  "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/group-by",
+  "example": "#",
+
+  "plugins": [{
+    "name": "bootstrap-table-group-by",
+    "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/group-by"
+  }],
+
+  "author": {
+    "name": "djhvscf",
+    "image": "https://avatars1.githubusercontent.com/u/4496763"
+  }
+}

+ 17 - 0
src/extensions/key-events/extension.json

@@ -0,0 +1,17 @@
+{
+  "name": "Key Events",
+  "version": "1.0.0",
+  "description": "Plugin to support the key events in the bootstrap table.",
+  "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/key-events",
+  "example": "http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/key-events.html",
+
+  "plugins": [{
+    "name": "bootstrap-table-key-events",
+    "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/key-events"
+  }],
+
+  "author": {
+    "name": "djhvscf",
+    "image": "https://avatars1.githubusercontent.com/u/4496763"
+  }
+}

+ 17 - 0
src/extensions/mobile/extension.json

@@ -0,0 +1,17 @@
+{
+  "name": "Mobile",
+  "version": "1.1.0",
+  "description": "Plugin to support the responsive feature.",
+  "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/mobile",
+  "example": "http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/mobile.html",
+
+  "plugins": [{
+    "name": "bootstrap-table-mobile",
+    "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/mobile"
+  }],
+
+  "author": {
+    "name": "djhvscf",
+    "image": "https://avatars1.githubusercontent.com/u/4496763"
+  }
+}

+ 17 - 0
src/extensions/multiple-search/extension.json

@@ -0,0 +1,17 @@
+{
+  "name": "Multiple Search",
+  "version": "1.0.0",
+  "description": "Plugin to support the multiple search.",
+  "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/multiple-search",
+  "example": "#",
+
+  "plugins": [{
+    "name": "bootstrap-table-multiple-search",
+    "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/multiple-search"
+  }],
+
+  "author": {
+    "name": "djhvscf",
+    "image": "https://avatars1.githubusercontent.com/u/4496763"
+  }
+}

+ 17 - 0
src/extensions/multiple-sort/extension.json

@@ -0,0 +1,17 @@
+{
+  "name": "Multiple Sort",
+  "version": "1.0.0",
+  "description": "Plugin to support the multiple sort.",
+  "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/multiple-sort",
+  "example": "#",
+
+  "plugins": [{
+    "name": "bootstrap-table-multiple-sort",
+    "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/multiple-sort"
+  }],
+
+  "author": {
+    "name": "dimbslmh",
+    "image": "https://avatars1.githubusercontent.com/u/745635"
+  }
+}

+ 17 - 0
src/extensions/natural-sorting/extension.json

@@ -0,0 +1,17 @@
+{
+  "name": "Natural Sorting",
+  "version": "1.0.0",
+  "description": "Plugin to support the natural sorting.",
+  "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/natural-sorting",
+  "example": "#",
+
+  "plugins": [{
+    "name": "bootstrap-table-natural-sorting",
+    "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/natural-sorting"
+  }],
+
+  "author": {
+    "name": "GreyWyvern",
+    "image": "https://avatars1.githubusercontent.com/u/137631"
+  }
+}

+ 17 - 0
src/extensions/reorder-columns/extension.json

@@ -0,0 +1,17 @@
+{
+  "name": "Reorder Columns",
+  "version": "1.1.0",
+  "description": "Plugin to support the reordering columns feature.",
+  "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/reorder-columns",
+  "example": "http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/reorder-columns.html",
+
+  "plugins": [{
+    "name": "bootstrap-table-reorder-columns",
+    "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/reorder-columns"
+  }],
+
+  "author": {
+    "name": "djhvscf",
+    "image": "https://avatars1.githubusercontent.com/u/4496763"
+  }
+}

+ 17 - 0
src/extensions/reorder-rows/extension.json

@@ -0,0 +1,17 @@
+{
+  "name": "Reorder Rows",
+  "version": "1.0.0",
+  "description": "Plugin to support the reordering rows feature.",
+  "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/reorder-rows",
+  "example": "http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/reorder-rows.html",
+
+  "plugins": [{
+    "name": "bootstrap-table-reorder-rows",
+    "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/reorder-rows"
+  }],
+
+  "author": {
+    "name": "djhvscf",
+    "image": "https://avatars1.githubusercontent.com/u/4496763"
+  }
+}

+ 17 - 0
src/extensions/resizable/extension.json

@@ -0,0 +1,17 @@
+{
+  "name": "Resizable",
+  "version": "1.0.0",
+  "description": "Plugin to support the resizable feature.",
+  "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/resizable",
+  "example": "http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/resizable.html",
+
+  "plugins": [{
+    "name": "bootstrap-table-resizable",
+    "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/resizable"
+  }],
+
+  "author": {
+    "name": "djhvscf",
+    "image": "https://avatars1.githubusercontent.com/u/4496763"
+  }
+}

+ 17 - 0
src/extensions/toolbar/extension.json

@@ -0,0 +1,17 @@
+{
+  "name": "Toolbar",
+  "version": "2.0.0",
+  "description": "Plugin to support the advanced search.",
+  "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/toolbar",
+  "example": "http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/toolbar.html",
+
+  "plugins": [{
+    "name": "bootstrap-table-toolbar",
+    "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/toolbar"
+  }],
+
+  "author": {
+    "name": "djhvscf",
+    "image": "https://avatars1.githubusercontent.com/u/4496763"
+  }
+}