<?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: Blank cell values and the select formatter</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/blank-cell-values-and-the-select-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/bugs/blank-cell-values-and-the-select-formatter/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Blank cell values and the select formatter</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/blank-cell-values-and-the-select-formatter#p8746</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/blank-cell-values-and-the-select-formatter#p8746</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>I think this have sence. Thanks. Fixed for the select.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 18 Aug 2009 11:05:27 +0300</pubDate>
        </item>
        <item>
        	<title>Pete on Blank cell values and the select formatter</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/blank-cell-values-and-the-select-formatter#p8712</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/blank-cell-values-and-the-select-formatter#p8712</guid>
        	        	<description><![CDATA[<p>I have a function I wrote to add empty rows for my inline editing on my grids.&#160; Since I have multiple grids that I use the function with I made it "generic" and it works great.&#160; Here is the code:</p>
</p>
<p>function addEmptyRow(gridName){</p>
<p>// alert(&#39;Add a Row&#39;);<br />if(gridName) {<br />var rowcount = 0;<br />var ajaxURL;<br />var objName = gridName[0].id;<br />// Get the row count from the server<br />// This could be dangerous if lines have been deleted and added, messing up row counts<br />ajaxURL = &#39;${.data_model.requestURI}?action=AjaxGetSubRecLastRow&#38;recType=&#39;+objName+&#39;&#38;subid=&#39;+ $(&#39;#emplist&#39;).val();</p>
<p>&#160;&#160;&#160; &#160;&#160;&#160; $.ajax({<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160; url: ajaxURL,<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160; async: false,<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160; cache: false,<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160; success: function(text){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160; &#160;&#160;&#160; &#160;&#160;&#160; rowcount = text;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160; &#160;&#160;&#160; &#160;&#160;&#160; rowcount++;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;<br />&#160;&#160;&#160; &#160;&#160;&#160; });<br />&#160;&#160;&#160; &#160;&#160;&#160; <br />var rc = $(gridName).addRowData(rowcount,{&#39; &#39;:" "},"last"); // duplicate row numbers prevent editing/updating (FYI)</p>
<p>}</p>
<p>}</p>
</p>
<p>This will produce a row in the grid with each of the cells being empty AND the editoptions containing the select options will also display.</p>
<p>When I changed the colmodel in my grid to use the formatter:&#39;select&#39; option, the addEmptyRow function stopped returning the select values and the entire cell was missing from the row. I tracked it down to this code around line #283 in jquery.fmatter.js</p>
<p>} else if (!isEmpty(cellval)) {</p>
<p>Since I was passing empty values to the addRowData, the formatter wasn&#39;t returning the contents or the cell.&#160; I removed the conditional on !isEmpty and ended up with this:</p>
<p>{ else&#160; {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(!cellval)<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; cellval = "";</p>
</p>
<p>Setting the cellval to ="" seemed to do the trick and so far I haven&#39;t seen any downside.&#160; Is there a better way to handle adding an empty row that wouldn&#39;t require this "trick" to get the select lists to show?&#160; I *think* this is a bug but it just could be one of those corner cases where the logic doesn&#39;t accomodate these values.</p></p>
]]></description>
        	        	<pubDate>Mon, 17 Aug 2009 11:04:30 +0300</pubDate>
        </item>
</channel>
</rss>