Preset the grid filter after loading

Hello,

Just wondering how a #select_filter can be set to a given value after a grid has loaded. For example, display all active and inactive records for a list of crews. The user then, normally, adjusts the filter so that only active records are showing.

active = ‘Y’, inactive = ‘N’ in my context.

Here the code for creating and loading the grid. Any ideas?

Thanks,
Mike

var crew_grid = new dhtmlXGridObject('crews_container'); crew_grid.setImagePath("dhtmlx/imgs/"); crew_grid.setHeader("Crew ID,Crew Name,Last Modified,Active"); crew_grid.attachHeader("#text_filter,#text_filter,&nbsp,#select_filter"); crew_grid.setInitWidths("100,150,150,60"); crew_grid.setColAlign("left,right,right"); crew_grid.setColSorting("int,str,date"); crew_grid.setSkin("dhx_skyblue"); crew_grid.setEditable(false); crew_grid.init(); crew_grid.parse(crews_array,"jsarray");

To select necessary option in #select_filter you can use getFilterElement method. docs.dhtmlx.com/doku.php?id=dhtm … iltering&s[]=getFilterElement#additonal_filtering_api

mygrid.getFilterElement(column_index).value=“some_value”

Thanks for the help. Here’s the two lines of code I end up needing at the end of the code above:

crew_grid.getFilterElement(3).value=‘Y’;
crew_grid.filterBy(3,‘Y’);