Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Kathy on Jun 24, 2009 14:57
open dhtmlx forum
combine custom and numeric_filter ?

I have custom filter (matches substrings) on one column and built-in #numeric_filter on another. I'm asked to combine filtering, so that grid only shows rows that match both filters. Is it possible?
Answer posted by dhxSupport on Jun 25, 2009 02:31
You can create any custom filter you need using filterBy() method. Please see more information here http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Data_filtering_search.html#grid_fsing
Answer posted by Kathy on Jun 25, 2009 03:21
I understand that I can create custom filter. My question though was about built-in #numeric_filter. If I use filterBy() on the column with #numeric_filter it does NOT filter numerically, i.e. operations like < > .. do not work. Is there another way to invoke it? And is there a way to make it invoke my custom filter? Thanks!
Answer posted by dhxSupport on Jun 25, 2009 03:46
You can attach in the header your custom filter as plain html input:
mygrid.setHeader("<input oclick='customFilteringFunction()' />,Column2,Column3");
customFilteringFunction() - your custom filtering function which will execute filterBy() method. 
Answer posted by Kathy on Jun 25, 2009 04:55
I am doing something similar, but it's not working for me because 'filterBy' on a column with #numeric_filter does not use the same logic as that filter. In other words, if I put '>15' into the filter, grid correctly shows all rows with number in that column > 15. But if I invoke 'filterBy' on that same column with that same '>15' value, grid shows nothing, because filterBy treats value literally, and not as expression. So. Is there a way to use standard built-in functionality of #numeric_filter in combination with a custom filter? So that when custom filter is triggered, it could invoke #numeric_filter on another column, and when #numeric_filter is triggered, it could invoke custom filter?
Answer posted by dhxSupport on Jun 25, 2009 05:23
>>So. Is there a way to use standard built-in functionality of #numeric_filter in combination with a custom filter
It's impossible. You can use 2nd filterBy() parameter as a function to create custom numeric_filter:
mygrid.filterBy(INDEX,someFilter);

function someFilter(...){

...

}


There is the detailed article about creating custom filters.  

Please, take a look http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Data_filtering_search.html