<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: Searching on text field with accentued chars on local datas </title>
	<link>http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>OlegK on Searching on text field with accentued chars on local datas </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p22085</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p22085</guid>
        	        	<description><![CDATA[<p>It is less complex problem as before. You can use&#160;<strong>sorttype</strong>&#160;as function.&#160;See <a href="http://www.ok-soft-gmbh.com/jqGrid/CustomSearchAndSort.htm" target="_blank">the new demo</a>. Try to sort ba &#39;Client&#39;.</p>
<p>Best regards<br />Oleg&#160;</p>
]]></description>
        	        	<pubDate>Mon, 14 Feb 2011 20:26:32 +0200</pubDate>
        </item>
        <item>
        	<title>olaf on Searching on text field with accentued chars on local datas </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p22084</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p22084</guid>
        	        	<description><![CDATA[<p>Oleg,</p>
<p>for the same grid my datas are ordered on geographics points&#39;name.</p>
<p>The accentued char <span style="color: #ff6600;">&#201;</span> is at the end of the list.</p>
</p>
<p>Abri Vallot</p>
<p>Aiguille de l&#39;Epaisseur</p>
<p>.........</p>
<p>Ecole</p>
<p>Emeindras de dessus</p>
<p>Engins</p>
<p>..........</p>
<p>Villard-de-Lans</p>
<p>Villeneuve-la-Salle</p>
<p>&#201;visa</p>
<p>--- End of the list</p>
<p>it is not UTF8 ordered</p>
<p>Thank for any help.</p>
]]></description>
        	        	<pubDate>Mon, 14 Feb 2011 19:49:55 +0200</pubDate>
        </item>
        <item>
        	<title>olaf on Searching on text field with accentued chars on local datas </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p22060</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p22060</guid>
        	        	<description><![CDATA[<p>Oleg</p>
<p>Wonderful and thank you for your amazing work.</p>
<p>Best regards</p>
<p>Olivier</p>
]]></description>
        	        	<pubDate>Sat, 12 Feb 2011 16:39:19 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on Searching on text field with accentued chars on local datas </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p22059</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p22059</guid>
        	        	<description><![CDATA[<p>Hi Olaf,</p>
<p>In the previous example I wanted mostly show <em>how one can overwrite methods</em> from <strong>$.jgrid.from</strong>. If you try to search in my first example for: Client contains &#39;bene&#39; instead of &#39;b&#233;ne&#39; you will find the both lines. So the problem is just in the additional conversion of the input line with the respect of <strong>myAccentRemovement</strong> function.</p>
<p>To fix the problem in the previous example one can just add some additional lines in the code and overwrite additionally the <strong>_toStr</strong> method:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2350' value='Select Code' data-codeid='sfcode2350' /></p>
<div class='sfcode' id='sfcode2350'>var oldFrom = $.jgrid.from;<br /> $.jgrid.from = function(source,initalQuery){<br />&#160;&#160;&#160; var result = oldFrom(source,initalQuery);<br />&#160;&#160;&#160; <strong>var old_toStr = result._toStr;<br />&#160;&#160;&#160; result._toStr=function(s) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; return myAccentRemovement(old_toStr(s));<br />&#160;&#160;&#160; };</strong><br />&#160;&#160;&#160; result._getStr=function(s) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var phrase=[];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(this._trim){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; phrase.push(&#34;jQuery.trim(&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br /> &#160;&#160;&#160; &#160; &#160; phrase.push(&#34;myAccentRemovement(String(&#34;+s+&#34;))&#34;);<br />&#160;&#160;&#160;&#160; &#160;&#160; if(this._trim){<br />&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160; phrase.push(&#34;)&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(!this._usecase){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; phrase.push(&#34;.toLowerCase()&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; return phrase.join(&#34;&#34;);<br />&#160;&#160;&#160; }<br />&#160;&#160;&#160; return result;<br /> }</div>
<p>You can see live <a href="http://www.ok-soft-gmbh.com/jqGrid/CustomSearch1.htm" target="_blank">here</a> that the new example work with "contain", "start with" or other operations.</p>
<p>Best regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Sat, 12 Feb 2011 14:50:55 +0200</pubDate>
        </item>
        <item>
        	<title>olaf on Searching on text field with accentued chars on local datas </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p22058</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p22058</guid>
        	        	<description><![CDATA[<p>Oleg,</p>
<p>sorry to answer so late to your suggestion;</p>
<p>I try your demo at : <a href="http://www.ok-soft-gmbh.com/jqGrid/CustomSearch.htm" rel="nofollow" target="_blank"><a href="http://www.ok-soft-gmbh.com/jq" rel="nofollow">http://www.ok-soft-gmbh.com/jq</a>.....Search.htm</a></p>
<p>It is OK for : Client begin with b&#233;ne -&#62; and find b&#233;nevise and benevise</p>
<p>It is not OK for : Client contains b&#233;ne -&#62; and find <span style="color: #ff0000;">NOTHING</span>.</p>
]]></description>
        	        	<pubDate>Sat, 12 Feb 2011 12:05:01 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on Searching on text field with accentued chars on local datas </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p21529</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p21529</guid>
        	        	<description><![CDATA[<p>Hi Olaf,</p>
<p>your question is difficult, but I found it interesting. So I prepared <a href="http://www.ok-soft-gmbh.com/jqGrid/CustomSearch.htm" target="_blank">the demo</a> which demonstrate the idea, how to solve the problem. Try to search in the grid for the string <em>benevise</em> and you will find also the string <em>b&#233;nevise</em>.</p>
<p>Of cause the replacement of accentuated characters in the string is not supported directly. So to solve the problem I made following. I replace <strong>_getStr</strong> method of the <strong>$.jgrid.from</strong>:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5558' value='Select Code' data-codeid='sfcode5558' /></p>
<div class='sfcode' id='sfcode5558'>$.jgrid.from = function(source,initalQuery){<br />&#160;&#160;&#160; var result = oldFrom(source,initalQuery);<br />&#160;&#160;&#160; result._getStr=function(s) {<br />&#160;&#160;&#160; &#160;&#160; var phrase=[];<br />&#160;&#160;&#160;&#160;&#160;&#160; if(this._trim){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; phrase.push(&#34;jQuery.trim(&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160; phrase.push(&#34;myAccentRemovement(String(&#34;+s+&#34;))&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160; if(this._trim){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; phrase.push(&#34;)&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160; if(!this._usecase){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; phrase.push(&#34;.toLowerCase()&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160; return phrase.join(&#34;&#34;);<br /> &#160;&#160;&#160; }<br />&#160;&#160;&#160; return result;<br /> }</div>
<p>where global function <strong>myAccentRemovement</strong> is defined as following</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2105' value='Select Code' data-codeid='sfcode2105' /></p>
<div class='sfcode' id='sfcode2105'>function myAccentRemovement(s) {<br />&#160;&#160;&#160; // the s parameter is always string<br />&#160;&#160;&#160; return s.replace(/[&#232;&#233;&#234;&#235;]/gi,&#39;e&#39;);<br /> }</div>
<p>Of cause you can include the code inside of <strong>_getStr</strong> function instead of <strong>myAccentRemovement</strong> call, but I made so in case of more complex implementation of the accent replacement.</p>
<p>To understand the solution I describe the main idea how the local searching work. The standard implementation of the local searching create string like</p>
<p>"(String(this.name) == String("benevise"))"</p>
<p>in case of "equal to" operation or</p>
<p>"(String(this.name).indexOf("benevise",0) &#62; -1)"</p>
<p>in case of "contain" operation.</p>
<p>Then inside of execute function (see <a href="https://github.com/tonytomov/jqGrid/blob/master/js/grid.base.js#L388" target="_blank">here</a>) will be the above string executed with respect of <strong>eval</strong> JavaScript function:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3305' value='Select Code' data-codeid='sfcode3305' /></p>
<div class='sfcode' id='sfcode3305'>$.each(_data,function(){<br />&#160;&#160;&#160;if(eval(match)){results.push(this);}<br />});<br />_data=results;</div>
<p>After the modification of <strong>_getStr</strong> function the code like</p>
<p>"(myAccentRemovement(String(this.name)) == myAccentRemovement(String("benevise")))"</p>
<p>will be executed.</p>
<p>Modifying my example you can implement practically any custom local searching/filtering.</p>
<p>Best regards<br />Oleg</p></p>
]]></description>
        	        	<pubDate>Tue, 04 Jan 2011 18:04:48 +0200</pubDate>
        </item>
        <item>
        	<title>olaf on Searching on text field with accentued chars on local datas </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p21506</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p21506</guid>
        	        	<description><![CDATA[<p>Thank you Oleg,</p>
<p>This option is already set to true and searching is not case sensitive;</p>
<p>But it does&#39;not solve searching on accentued chars;</p>
<p>Example : local searching "benevise" do not find "b&#233;nevise"; json data is "B\u00e9nevise"</p>
<p><span style="color: #33cccc;">Happy New Year</span></p>
]]></description>
        	        	<pubDate>Sun, 02 Jan 2011 17:11:45 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on Searching on text field with accentued chars on local datas </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p21504</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p21504</guid>
        	        	<description><![CDATA[<p>Try to use <a href="/jqgridwiki/doku.php?id=wiki:options" target="_blank">ignoreCase:true</a> option of jqGrid.</p>
]]></description>
        	        	<pubDate>Sun, 02 Jan 2011 14:06:02 +0200</pubDate>
        </item>
        <item>
        	<title>olaf on Searching on text field with accentued chars on local datas </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p21501</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/searching-on-text-field-with-accentued-chars-on-local-datas#p21501</guid>
        	        	<description><![CDATA[<p>How to ignore case and accentued chars searching on local datas (after a loadonce: true;)</p>
]]></description>
        	        	<pubDate>Sat, 01 Jan 2011 20:23:18 +0200</pubDate>
        </item>
</channel>
</rss>