Now I would like to allow the user to have multiple selects, means that he can select more that one items from the filter list. Is that possible? If yes, how?
Unfortunately the filters on grid have OR logic. So it’s not available to use several filters.
You will have to create your own custom filter. Here you can find a tutorial: docs.dhtmlx.com/doku.php?id=dhtm … of_filters
Unfortunately the filtering by AND logic (show “apple” AND “banana”) is not available with default filters. All in-built filters of dhtmlxGrid use OR logic.
The only way is to create your own custom select filter.
I modified the original code to handle this seemingly basic requirement. I am not sure if I broke anything since I just recently began using the grid. My goal was to have a set of filter buttons that would filter by one, none, or any combination of order statuses instead of only one at a time ever. When you set the FilterBy, simply pass in your values concatenated with ||.
Note: The statuses I am filtering on are strings. I have not yet figured out of this will break any other types. I will update the code if or when I encounter those situations.
[code]dhtmlXGridObject.prototype._filterA=function(column,value){
if (value=="") return;
var d=true;
if (typeof(value)==“function”) d=false;
else value=(value||"").toString().toLowerCase();
if (!this.rowsBuffer.length) return;
// ERIC - hack apart the filter value to accept multiple values
var values = value.split(’||’);
for (var i=this.rowsBuffer.length-1; i>=0; i--){
var llFound = false;
for (var x=0; x<= values.length-1; x++){
if (d?(this._get_cell_value(this.rowsBuffer[i],column).toString().toLowerCase().indexOf(values[x])!=-1):(!values[x].call(this, this._get_cell_value(this.rowsBuffer[i],column),this.rowsBuffer[i].idd)))
{
// Found one of them
llFound = true
break;
}
}
if (!llFound)
this.rowsBuffer.splice(i,1);//filter row
}
}[/code]
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan