Allow updating the filters separately
authorJoey Schulze <joey@infodrom.org>
Sun, 7 Mar 2010 11:55:26 +0000 (12:55 +0100)
committerJoey Schulze <joey@infodrom.org>
Sun, 7 Mar 2010 11:55:26 +0000 (12:55 +0100)
lib/functions.js

index de69409..2de1400 100644 (file)
@@ -224,6 +224,25 @@ function grid_update(grid, filter, value)
     grid.buffer.fetch(-1);
 }
 
+function grid_update_filters(grid)
+{
+    var todo = false;
+    for (var c=0; c < grid.headerColCnt; c++) {
+       var fmt = grid.columns[c].format;
+       if (typeof fmt.filterUI != 'string') continue;
+       if (fmt.filterUI != 's') continue;
+       $(grid.filterId(c)).options.length = 1;
+
+       var options = {};
+       Object.extend(options, grid.buffer.ajaxOptions);
+       var colnum = typeof(fmt.filterCol)=='number' ? fmt.filterCol : c;
+
+       options.parameters = 'id='+grid.tableId+'&distinct='+colnum;
+       options.onComplete = grid.filterValuesUpdate.bind(grid,c);
+       new Ajax.Request(grid.buffer.dataSource, options);
+    }
+}
+
 var calendars = new Array();
 function calendar_callback(value)
 {