How do I change the logic of the #combo_filter so that it searches the entire string (’%mask%’), instead of the default where it only searches from the right of the string (‘mask%’)?
Is the change made on the client side script or the server side script?
Thank you in advance for your assistance.
sematik
February 5, 2015, 12:01pm
#2
Please, try to use the following “#combo_filter_strict ”:
dhtmlXGridObject.prototype._in_header_combo_filter_strict=function(t,i){
t.innerHTML="<div style='width:100%; padding-left:2px; overflow:hidden; ' class='combo'></div>";
t.onselectstart=function(){ return (event.cancelBubble=true); }
t.onclick=t.onmousedown=function(e){ (e||event).cancelBubble=true; return true; }
this.makeFilter(t.firstChild,i);
t.firstChild._filter=function(){
if (t.firstChild.value=="") return "";
var value = t.firstChild.value.toLowerCase();
return function(val){
return (val.toString().toLowerCase()==value);
};
};
this._filters_ready();
}
I tried the code but it still gives me the same result as combo_filter.
What I want to happen is as follows:
If the values of the combo box are:
apple
grapes
orange
pineapple
strawberries
and I type the letters ‘ap’ in the combo box, my options should show
apple
grapes
pineapple
When I use the code above it only shows apple as it is the only option that BEGINS with ‘ap’.
Please let me know what I am doing wrong. Thanks in advance for your assistance.
You may try to use the following custom filter:
dhtmlXGridObject.prototype._in_header_combo_filter_strict=function(t,i){
t.innerHTML="
";
t.onselectstart=function(){ return (event.cancelBubble=true); }
t.onclick=t.onmousedown=function(e){ (e||event).cancelBubble=true; return true; }
this.makeFilter(t.firstChild,i);
t.firstChild._filter=function(){
if (t.firstChild.value=="") return “”;
var value = t.firstChild.value.toLowerCase();
return function(val){
return (val.toLowerCase().indexOf(value.toLowerCase())!==-1);
};
};
this._filters_ready();
}