EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: A-K on November 27, 2014, 12:39:28 PM



Title: Some questions about filters
Post by: A-K on November 27, 2014, 12:39:28 PM
Hey,
I wanted to know why everytime that I need to change properties in the datagrid that requires
to call the datagrid constructor like this code:
Code:
$('#dg').datagrid({
        nowrap: false,
        autoRowHeight: true
    });

it requires me to configure the filters again. Why does it remove the filters from the table?

Also, why when calling
Code:
$('#dg').datagrid('removeFilterRule');

it does not return the data without the filters? I cannot reload at some points and if I need to remove the current filter
I cannot get back the data.

Thanks!


Title: Re: Some questions about filters
Post by: jarry on November 27, 2014, 06:39:40 PM
When calling '.datagrid({...})', the datagrid will be re-created. After created a datagrid, the user must call 'enableFilter' method again to create and enable filter functionality.


Title: Re: Some questions about filters
Post by: A-K on November 28, 2014, 12:55:25 AM
Thanks for the replay, and also what about this code:

Code:
$('#dg').datagrid('removeFilterRule');

It only deletes the filter but the data remains the same, this isnt really helping and it looks like a bug,
Why when removing the filter it doesnt return back the data without the filters? just like manually deleting the filter.


and is there a way to achieve
Code:
$('#dg').datagrid({
        nowrap: false,
        autoRowHeight: true
    });
 without re-creating the datagrid? he is created with nowrap: true and autoRowHeight: false and I need to dynamically change this properties.

Thanks!


Title: Re: Some questions about filters
Post by: jarry on November 28, 2014, 01:13:52 AM
After removing a filter rule, you can call 'doFilter' method to force the datagrid to refresh the data.
Code:
$('#dg').datagrid('removeFilterRule');
$('#dg').datagrid('doFilter');