Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Brendan on Aug 19, 2009 07:34
open dhtmlx forum
combo filters with updated values of column after previous filtering

I have the most recent build of dhtmlxGrid. I am using combo_filters in a couple of my column headers. After filtering one of the columns with the combo_filter, I would like the other combo_filter to update itself with the new distinct values after the filtering.

I thought maybe calling refreshFilters() using the 'onFilterEnd' event would allow me to do this, but I don't have any luck with that. For me, it just doesn't do anything.

I've tried looking through the knowledge base but could not find exactly what I was looking for.

Any ideas would be appreciated! Thank you in advance!
Answer posted by Support on Aug 20, 2009 06:53
>>I would like the other combo_filter to update itself
refreshFilters always take the list of values from the full data not from the filtered set
The next code snippet switches inner collections pointer and will result in desired effect - refresh filters from filtered set

mygrid.attachEvent("onFilterEnd",function(){
        var back = mygrid._f_rowsBuffer;
        mygrid._f_rowsBuffer = mygrid.rowsBuffer;

        mygrid.refreshFilters(); //update all filters

        mygrid._f_rowsBuffer=back;
})
Answer posted by Brendan on Aug 20, 2009 07:05
Thank you for your response.  This code produces the correct results after the first filtering, however I cannot filter anything else after the first time.  Apparently it clears out all the options in the combo box.

Thanks again!
Answer posted by Supoport on Aug 21, 2009 08:37
You still able to select empty option ( the first in combo ) to return to the full list of options.
( if you have not an empty option in combo-box , please try to update the dhtmlxgrid_fitler.js with attached one ) 
Attachments (1)