Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Sujoy Abraham on Sep 18, 2008 22:31
open dhtmlx forum
Retaining the filtered rows.

hi,

i have two filters in my header. please give a solution to how can i retain the filter values after updation.

Current Scenario:

i filter some rows using the filter. now when i click update button the selected rows are updated, also the grid is refreshed with full records.

Required Scenario:

when i update the selected rows, only the selected rows should be retained. also if master checkbox is checked i have to uncheck it.

 

please provide the solution asap.

thanking you,

Regards,

Sujoy

Answer posted by Support on Sep 22, 2008 01:19
You can get filter's value before refreshing and save it in cookie.

But grid doesn't provide API to get a value or to place some value in the filter.

You should use DOM methods to get filter's object.

Then in order to restore filter's state, you can place the value from cookie in filter and call filterByAll() method.

For example, in case of the select filter:
 
mygrid.loadXML(url,doOnLoad)

function doOnLoad(){
   var input = mygrid.hdr.rows[2].cells[1].getElementsByTagName("SELECT")[0];
   input.value="Foo";
   mygrid.filterByAll();
}

Where 2 means that filter is placed in the second header, 1 - the second cell  in header.