Changing select filter entries based on the collected values


We have a grid with a column that contains values that are the same except for case, e.g.,


In our grid, this column has a select filter which contains a drop down list element for each of the case sensitive elements. However, since the filtering is case insensitive, selecting any of those elements returns the matching rows for all of them. We like the case insensitive filtering and would like to prune the filter list so that only a lower case version of each value appears in the drop down list. I’ve tried to modify the list in the “onCollectValues” callback, but at that time, the filter element returned by getFilterElement has not been populated, so I don’t have any source values to work with. Is there a way to achieve the filtering of elements in the drop down list after the values have been collected?

Thanks for your consideration.



You may redefine the logic of the filter. Here you can find an example of the logic:

Or you may add the following custom filter:

	t.innerHTML="<select style='width:90%;'></select>";
	t.onclick=function(e){ (e||event).cancelBubble=true; return false; }
	var combos = this.combos;
		var value = t.firstChild.value;
		if (!value) return "";
		if (combos[i])
            value = combos[i].keys[combos[i].values._dhx_find(value)];
		return function(val){
			return (val.toString()==value); 

just try to use #select_filter_case in your grid configuration.


Thanks for the reply. However, the solutions you provide change the way the filtering works, e.g., the custom filter code above will filter in a case-sensitive manner, and not the way the list of elements in the filter drop down list are generated. I want to preserve the case insensitive filtering, but I want the list of filter choices in the drop down list to only contain one choice (probably lower case version) for each element. In my original example of column data containing


I’d like the filter drop down list to contain only


and selecting this element will match columns that contain any of abc, Abc, aBc, abC. Currently all 4 values are put into the drop down list and using “select_filter” matches all the rows containing abc regardless of case.

If I add the select_filter_case as above, the drop down list still contains all the case variant elements, but the filtering only matches the rows with an exact case match.

I thought the onCollectValues event would be the appropriate place to make the list elements unique, but the filter element hasn’t been populated when this event is triggered, so I’d have to iterate all the data to create the list from scratch (not an optimal solution).




I apologize. Now I see the request. Unfortunately it is not available to change the options in the list to lower case. without inner code modifications.
Only the “onCollectValues” event (as you’ve mentioned) can be used, but it requires to modify all the filtering process.