浏览代码

Added datepicker option to Filter Control

Dennis Hernández 10 年之前
父节点
当前提交
bf650da961

+ 1 - 1
src/bootstrap-table.js

@@ -2218,7 +2218,7 @@
 
     BootstrapTable.prototype.getScrollPosition = function () {
         return this.scrollTo();
-    }
+    };
 
     BootstrapTable.prototype.selectPage = function (page) {
         if (page > 0 && page <= this.options.totalPages) {

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

@@ -1,8 +1,7 @@
 # Table Filter Control
 
 Use Plugin: [bootstrap-table-filter-control](https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/filter-control)
-Dependence if you use the datepicker option: [jquery-ui](http://code.jquery.com/ui/1.11.4/jquery-ui.js) v1.11.4 (must include the css file), </br>
-[jquery-ui css](http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css) v1.11.4
+Dependence if you use the datepicker option: [bootstrap-datepicker](https://github.com/eternicode/bootstrap-datepicker) v1.4.0
 
 ## Usage
 
@@ -28,7 +27,7 @@ Dependence if you use the datepicker option: [jquery-ui](http://code.jquery.com/
 
 ### filterDatepickerOptions
 * type: Object
-* description: If the datepicker option is set use this option to configure the datepicker with the native options. Use this way: `data-filter-datepicker-options='{"firstDay":2, "changeMonth": true, "showButtonPanel": true}'`.
+* description: If the datepicker option is set use this option to configure the datepicker with the native options. Use this way: `data-filter-datepicker-options='{"autoclose":true, "clearBtn": true, "todayHighlight": true}'`.
 * default: `undefined`
 
 ## Events

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

@@ -202,11 +202,13 @@
                 $.each(this.options.columns, function (i, column) {
                     if (column.filterControl !== undefined && column.filterControl.toLowerCase() === 'datepicker') {
                         column.filterDatepickerOptions = $.extend(column.filterDatepickerOptions, {
-                            onSelect: function (text, obj) {
-                                $(obj.input).keyup();
-                            }
+                            calendarWeeks: true
                         });
-                        that.$header.find('.date-filter-control.' + column.field).datepicker(column.filterDatepickerOptions);
+
+                        that.$header.find('.date-filter-control.' + column.field).datepicker(column.filterDatepickerOptions)
+                            .on('changeDate', function (e) {
+                                $(e.currentTarget).keyup();
+                            });
                     }
                 });
             }