Filter DHTMLX Grid Through Dropdown vs. API


I have a grid that loads XML via an ajax call to a php page. After the data loads, I can filter the grid through the api using the filterBy call. However, the grid also has filter dropdowns in the header, and I would like to filter the grid it in such a way that it displays the filtered item in the dropdown as well as filtering the grid, so that the user knows the grid is filtered and why.

The reason for this is that the user can set a data filter on the another page. After the filter is set, the site will remember the filter and data on any page the user visits should have the filter applied. So basically, if the filter is set, when they hit this page and it loads it pulls data into the grid via ajax, then it should filter the grid and display the filter in the grid’s header dropdown filter.

The user should be able to remove the filter or change the filter using the the dropdown filters in the grid’s header without additional ajax requests. In other words all the data should be retrieved and then the filter applied so that the user can slice and dice the data using the filters in the header - I don’t want to restrict the data being sent from the database, I prefer to restrict the data in the client.

Is there an API or method that will let me do this? I haven’t been able to figure this out.



To set value to the header filter you can use getFilterElement() method. … ilterbyall

If you don’t want to call additional ajax request while filtering you should not use dynamic loading and server side filtering.

Is it possible to drive one filtering element in a grid header off another element in the header.  As an example, I have two dhtmlxcombos in a dhtmlxgrid header.  The Combo A filters on column A, Combo B filters on column B.  Column B should be dependent on Column A.  Is it possible to have the list of items displayed in Combo B be dependent on what the user selected in Combo A?  If Item A in Combo A is picked, Combo should only display items from Column B that will be displayed after the filter.

Can this be done?


It can be done with refreshFilter() mehtod and “onFilterEnd” event. Please find more information here … eshFilters