Preset the grid filter after loading


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?


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. … iltering&s[]=getFilterElement#additonal_filtering_api


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