Upgrade to ExtJS 3.1.0 - Released 12/16/2009
[extjs.git] / examples / ux / gridfilters / GridFilters.js
index 2802c52..4d88d16 100644 (file)
@@ -1,5 +1,5 @@
 /*!
- * Ext JS Library 3.0.3
+ * Ext JS Library 3.1.0
  * Copyright(c) 2006-2009 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
@@ -180,7 +180,8 @@ Ext.ux.grid.GridFilters = Ext.extend(Ext.util.Observable, {
     updateBuffer : 500,\r
 \r
     /** @private */\r
-    constructor : function (config) {          \r
+    constructor : function (config) {\r
+        config = config || {};\r
         this.deferredUpdate = new Ext.util.DelayedTask(this.reload, this);\r
         this.filters = new Ext.util.MixedCollection();\r
         this.filters.getKey = function (o) {\r
@@ -195,8 +196,12 @@ Ext.ux.grid.GridFilters = Ext.extend(Ext.util.Observable, {
     init : function (grid) {\r
         if (grid instanceof Ext.grid.GridPanel) {\r
             this.grid = grid;\r
-\r
+            \r
             this.bindStore(this.grid.getStore(), true);\r
+            // assumes no filters were passed in the constructor, so try and use ones from the colModel\r
+            if(this.filters.getCount() == 0){\r
+                this.addFilters(this.grid.getColumnModel());\r
+            }\r
           \r
             this.grid.filters = this;\r
              \r
@@ -447,7 +452,7 @@ TODO: lazy rendering
      */\r
     onBeforeLoad : function (store, options) {\r
         options.params = options.params || {};\r
-        this.cleanParams(options.params);              \r
+        this.cleanParams(options.params);       \r
         var params = this.buildQuery(this.getFilterData());\r
         Ext.apply(options.params, params);\r
     },\r
@@ -651,7 +656,7 @@ filters[0][data][value]="someValue3"&
      * </ul></div>\r
      * Override this method to customize the format of the filter query for remote requests.\r
      * @param {Array} filters A collection of objects representing active filters and their configuration.\r
-     *           Each element will take the form of {field: dataIndex, data: filterConf}. dataIndex is not assured\r
+     *    Each element will take the form of {field: dataIndex, data: filterConf}. dataIndex is not assured\r
      *    to be unique as any one filter may be a composite of more basic filters for the same dataIndex.\r
      * @return {Object} Query keys and values\r
      */\r