EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: acreonte82 on February 25, 2014, 10:54:03 AM



Title: Dynamic filter
Post by: acreonte82 on February 25, 2014, 10:54:03 AM
Hi stworthy,
I've an easy request , I hope  ;D

In my application I created a js script that retrive data from server and build a dynamic datagrid.
(here my old post http://www.jeasyui.com/forum/index.php?topic=2197.0).

My question is: how I can build dynamic filter (combobox with checkbox) for each columns and, for each filter columns, a grouping of value for that column?



Title: Re: Dynamic filter
Post by: stworthy on February 25, 2014, 07:01:46 PM
Before enabling filter, the filter configuration must be ready. Thus you need to read these information from server and then build the data that looks like this:
Code:
var filterConf = [{
field:'listprice',
type:'numberbox',
options:{precision:1},
op:['equal','notequal','less','greater']
},{
field:'unitcost',
type:'numberbox',
options:{precision:1},
op:['equal','notequal','less','greater']
}]

Finally call 'enableFilter' method with 'filterConf' parameter value.
Code:
$('#dg').datagrid('enableFilter', filterConf);