<?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: Unexpected result with a custom formatter</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/unexpected-result-with-a-custom-formatter</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/unexpected-result-with-a-custom-formatter/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Pete on Unexpected result with a custom formatter</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/unexpected-result-with-a-custom-formatter#p21225</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/unexpected-result-with-a-custom-formatter#p21225</guid>
        	        	<description><![CDATA[<p>OK. So I had an epiphany when I looked at the output.&#160; It needed to be ESCAPED so that the blank values came through correctly.&#160; So the corrected function now looks like:</p>
<p>function formatNoteLink(cellvalue, objects, rowObjects){</p>
<p>if(cellvalue.length==0)<br />&#160;&#160; &#160;cellvalue = "No note";</p>
<p>var formattedLink = "&#60;a href=javascript:alert(&#39;"+escape(cellvalue)+"&#39;)&#62;Click for note&#60;/a&#62;";</p>
<p>return formattedLink;</p>
<p>}</p>
]]></description>
        	        	<pubDate>Thu, 09 Dec 2010 03:07:48 +0200</pubDate>
        </item>
        <item>
        	<title>Pete on Unexpected result with a custom formatter</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/unexpected-result-with-a-custom-formatter#p21222</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/unexpected-result-with-a-custom-formatter#p21222</guid>
        	        	<description><![CDATA[<p>I&#160; have a grid that uses inline editing.&#160; One of the column contains a large amount of text so I decided to create a link that would execute some javascript that would display the text in a dialog and allow editing.&#160; After trying the standard link formatter I decided to write a custom formatter to format the link to call the javascript.&#160; Here is a simple example of how the custom formatter works:</p>
</p>
<p>function formatNoteLink(cellvalue, objects, rowObjects){</p>
<p>if(cellvalue.length==0)<br />&#160;&#160; &#160;cellvalue = "No note";</p>
<p>var formattedLink = "&#60;a href=javascript:alert(&#39;"+cellvalue+"&#39;)&#62;&#39;Click for note&#39;&#60;/a&#62;";</p>
<p>return formattedLink;</p>
<p>}</p>
</p>
<p>If the cell value was blank what I would expect is that the returned value would look something like this:</p>
<p>&#60;a href=javascript:alert(&#39;No note&#39;)&#62;&#39;Click for note&#39;&#60;/a&#62;</p>
</p>
<p>Instead I see something like this:</p>
<pre id="line1">&#60;a href="javascript:alert(&#39;No" note="" )=""&#62;&#39;Click for note&#39;&#60;/a&#62;<br /></pre>
<p>It seems that the blanks in the cellvalue cause the string to be parsed incorrectly.&#160; I don&#39;t know if this is a javascript issue or is something that jqgrid is causing.&#160;</p>
<p>I am running jqGrid&#160; 3.7.1</p>
<p>Ideas?</p>
<p>Thanks,</p>
<p>Pete</p></p>
]]></description>
        	        	<pubDate>Wed, 08 Dec 2010 19:11:35 +0200</pubDate>
        </item>
</channel>
</rss>