<?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: bug in unformatter of the currency</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/bug-in-unformatter-of-the-currency</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/bugs/bug-in-unformatter-of-the-currency/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on bug in unformatter of the currency</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/bug-in-unformatter-of-the-currency#p25963</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/bug-in-unformatter-of-the-currency#p25963</guid>
        	        	<description><![CDATA[<p>Oleg,</p>
<p>Your code is correct. The formatter first add spaces and separators and the prefix and suffix &#160;- i.e the unformat should be in reverse order - remove prefix and sufix and then for with separators.</p>
<p>Also fixed.</p>
<p>Thanks&#160;</p>
]]></description>
        	        	<pubDate>Thu, 16 Feb 2012 08:28:08 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on bug in unformatter of the currency</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/bug-in-unformatter-of-the-currency#p25950</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/bug-in-unformatter-of-the-currency#p25950</guid>
        	        	<description><![CDATA[<p>Hello Tony,</p>
<p>the unformatter of currency removes <strong>prefix</strong> and <strong>suffix</strong> in the wrong way. <a href="https://github.com/tonytomov/jqGrid/blob/v4.3.1/js/jquery.fmatter.js#L515" target="_blank">The current implementation</a>&#160;</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4369' value='Select Code' data-codeid='sfcode4369' /></p>
<div class='sfcode' id='sfcode4369'>ret = $(cellval).text().replace(stripTag,&#39;&#39;).replace(op.decimalSeparator,&#39;.&#39;)<br />&#160; &#160; &#160; &#160; &#160; .replace(op.prefix,&#39;&#39;).replace(op.suffix,&#39;&#39;);</div>
<p>produce "200.00&#8364;" if it unformats the string "200.00 &#8364;" where <strong>suffix: &#39; &#8364;&#39;</strong> and <strong>thousandsSeparator: &#39; &#39;</strong>. First all blanks will be removed from the string and then the suffix &#39; &#8364;&#39; will be not more found.</p>
<p>The correct way will be first remove the prefix <em>from the beginning</em> of the string and remove the suffix <em>from the end</em> of the string. After that one can remove <strong>thousandsSeparator</strong> and replace <strong>decimalSeparator</strong> to <strong>&#39;.&#39;</strong>. So the code can be fixed as</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2335' value='Select Code' data-codeid='sfcode2335' /></p>
<div class='sfcode' id='sfcode2335'>ret = $(cellval).text();<br />if (op.prefix) {<br />&#160; &#160; ret = ret.substr(op.prefix.length);<br />}<br />if (op.suffix) {<br />&#160; &#160; ret = ret.substr(0, ret.length - op.suffix.length);<br />}<br />ret = ret.replace(stripTag,&#39;&#39;).replace(op.decimalSeparator,&#39;.&#39;);</div>
<p>Best regards<br />Oleg</p></p>
]]></description>
        	        	<pubDate>Wed, 15 Feb 2012 14:14:40 +0200</pubDate>
        </item>
</channel>
</rss>