EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rezzonico on April 09, 2018, 08:51:09 AM



Title: datagrid + filterRules
Post by: rezzonico on April 09, 2018, 08:51:09 AM
Hi all,

I need to reload a datagrid and pass the filterRules.
Here is my code:

Code:
                           url = 'prog.cgi?filterRules=[{field:"Active",value:"1"}]',
                           $(this).combogrid('grid').datagrid('reload', url);

The problem is that at the server site I receive the following error:

Code:
unexpected end of string while parsing JSON string, at character offset 3 (before "ield:"Active",value:...") at 

Regards.
Miche




Title: Re: datagrid + filterRules
Post by: stworthy on April 09, 2018, 07:38:24 PM
You should stringify your object before sending to the server.
Code:
var rules = JSON.stringify([{field:"Active",value:"1"}]);
...

If you are using the 'datagrid-filter.js' extension, set the 'remoteFilter' property to true to filter rows on the server. Please look at this example https://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=material&dir=ltr&pitem=Remote%20Filtering%20on%20DataGrid&sort=


Title: Re: datagrid + filterRules
Post by: rezzonico on April 10, 2018, 04:47:29 AM
Thanks !

Miche