Forum
20:23
08/01/2010
14:06
10/08/2009
Try to use ignoreCase:true option of jqGrid.
17:11
08/01/2010
18:04
10/08/2009
Hi Olaf,
your question is difficult, but I found it interesting. So I prepared the demo which demonstrate the idea, how to solve the problem. Try to search in the grid for the string benevise and you will find also the string bénevise.
Of cause the replacement of accentuated characters in the string is not supported directly. So to solve the problem I made following. I replace _getStr method of the $.jgrid.from:
var result = oldFrom(source,initalQuery);
result._getStr=function(s) {
var phrase=[];
if(this._trim){
phrase.push("jQuery.trim(");
}
phrase.push("myAccentRemovement(String("+s+"))");
if(this._trim){
phrase.push(")");
}
if(!this._usecase){
phrase.push(".toLowerCase()");
}
return phrase.join("");
}
return result;
}
where global function myAccentRemovement is defined as following
// the s parameter is always string
return s.replace(/[èéêë]/gi,'e');
}
Of cause you can include the code inside of _getStr function instead of myAccentRemovement call, but I made so in case of more complex implementation of the accent replacement.
To understand the solution I describe the main idea how the local searching work. The standard implementation of the local searching create string like
"(String(this.name) == String("benevise"))"
in case of "equal to" operation or
"(String(this.name).indexOf("benevise",0) > -1)"
in case of "contain" operation.
Then inside of execute function (see here) will be the above string executed with respect of eval JavaScript function:
if(eval(match)){results.push(this);}
});
_data=results;
After the modification of _getStr function the code like
"(myAccentRemovement(String(this.name)) == myAccentRemovement(String("benevise")))"
will be executed.
Modifying my example you can implement practically any custom local searching/filtering.
Best regards
Oleg
12:05
08/01/2010
Oleg,
sorry to answer so late to your suggestion;
I try your demo at : http://www.ok-soft-gmbh.com/jq.....Search.htm
It is OK for : Client begin with béne -> and find bénevise and benevise
It is not OK for : Client contains béne -> and find NOTHING.
14:50
10/08/2009
Hi Olaf,
In the previous example I wanted mostly show how one can overwrite methods from $.jgrid.from. If you try to search in my first example for: Client contains 'bene' instead of 'béne' you will find the both lines. So the problem is just in the additional conversion of the input line with the respect of myAccentRemovement function.
To fix the problem in the previous example one can just add some additional lines in the code and overwrite additionally the _toStr method:
$.jgrid.from = function(source,initalQuery){
var result = oldFrom(source,initalQuery);
var old_toStr = result._toStr;
result._toStr=function(s) {
return myAccentRemovement(old_toStr(s));
};
result._getStr=function(s) {
var phrase=[];
if(this._trim){
phrase.push("jQuery.trim(");
}
phrase.push("myAccentRemovement(String("+s+"))");
if(this._trim){
phrase.push(")");
}
if(!this._usecase){
phrase.push(".toLowerCase()");
}
return phrase.join("");
}
return result;
}
You can see live here that the new example work with "contain", "start with" or other operations.
Best regards
Oleg
16:39
08/01/2010
19:49
08/01/2010
Oleg,
for the same grid my datas are ordered on geographics points'name.
The accentued char É is at the end of the list.
Abri Vallot
Aiguille de l'Epaisseur
.........
Ecole
Emeindras de dessus
Engins
..........
Villard-de-Lans
Villeneuve-la-Salle
Évisa
--- End of the list
it is not UTF8 ordered
Thank for any help.
20:26
10/08/2009
It is less complex problem as before. You can use sorttype as function. See the new demo. Try to sort ba 'Client'.
Best regards
Oleg
Most Users Ever Online: 715
Currently Online:
41 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66