jQuery UI Widgets › Forums › Grid › Filter and characters with accents
Tagged: grid filtering
This topic contains 4 replies, has 2 voices, and was last updated by antonomase 11 years, 10 months ago.
-
Author
-
Hi,
I have a Grid with some columns. The first one (nom) contains name of societies with accents like ‘Bergère de France’ or ‘Fürstenberg’
I have installed a filter on this columns :
{text: ‘Nom‘, datafield: ‘NOM’, filtertype: ‘textbox’, filtercondition: ‘contains’},
If i write Berg in the textbox, I have all the names containing b e r and g : it’s OK.
But if i write Bergè or Berge (without accent), the grid becomes empty.How can the filter condition work with characters with accents ?
Best regards,
Hi antonomase,
The possible filter conditions are explained in this help topic: jquery-grid-filtering.htm.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi,
Thanks for your answer. But i do not see a special condition for filtering words containing characters like é, ç, à, ü, …
How is it possible to have the “standard” filter working with words containing these characters ?
Hi antonomas
The filtering uses JavaScript operators like
==, <, >, <=, >=
to compare strings, numbers, dates, bool values. I suppose that to compare such strings, you will have to specify appropriate encoding to your page.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Thanks for your answer.
For having letters encoded send by ajax/json, I must encode them on the server otherwise the string with accentuated letters remains blank.
(code PHP)...while ($rs->fetchInto($row)) { $result[$i]["ID"] = $row["ID"]; $result[$i]["NOM"] = htmlentities($row["NOM"]); $result[$i]["VILLE"] = htmlentities($row["VILLE"]); $i++;}echo json_encode($result)
;
The string received by javascript contains html encoding like “Bergère”. So the comparison with “Bergère” typed on the keyboard does not work.
The solution is to decode html encoded string with this tool http://www.strictly-software.com/htmlencode (or another one)
var eta_GridModel = function () { this.items = ko.observableArray(); var me = this; $.ajax({ datatype: 'json', url: "return_list.php" }).done(function (data) { data = Encoder.htmlDecode(data); var jsonData = $.parseJSON(data); me.items(jsonData); });}
And now, the filter works.
The problem will be the same with string containing © or another &xxxx; character.Best regards
-
AuthorPosts
You must be logged in to reply to this topic.