<?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: SetRowData and Dates</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/setrowdata-and-dates</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/setrowdata-and-dates/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on SetRowData and Dates</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/setrowdata-and-dates#p16101</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/setrowdata-and-dates#p16101</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Could you please post what is the exact data passed to the setRowData.</p>
<p>I&#39;m not sure, but the problem apper to be here:</p>
<p>if (cellvalue.indexOf("Date") == -1) return;</p>
<p>should be</p>
<p>if (cellvalue.indexOf("Date") == -1) return "";</p>
</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 31 Mar 2010 18:33:56 +0300</pubDate>
        </item>
        <item>
        	<title>SimonL on SetRowData and Dates</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/setrowdata-and-dates#p15988</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/setrowdata-and-dates#p15988</guid>
        	        	<description><![CDATA[<p>Hi,</p>
</p>
<p>I&#39;m using version 3.6.4 of jqgrid and having a problem with the SetRowData method. I&#39;m using my own forms (Jquery UI Modal forms). After some debugging I&#39;ve discovered the problem is because of a date column I have in my grid. If I remove this column the SetRowData method works fine.</p>
</p>
<p>Here is the column definition:</p>
</p>
<p>{ datefmt:&#39;dd/mm/YYYY&#39;, formatter: &#39;dateFormatter&#39;, searchoptions: { dataInit: datePick, searchhidden: true }, name: &#39;DateAcquired&#39;, search: true, sortable: true, hidden: false, index: &#39;DateAcquired&#39;, width: 70, align: &#39;left&#39;, stype: "date" }</p>
</p>
<p>This is my custom dateFormatter:</p>
</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.fn.fmatter.dateFormatter = function(cellvalue, options, rowObject) {</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (cellvalue == null) return &#39;&#39;;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (cellvalue.indexOf("Date") == -1) return;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Date arrives from server in the following format&#160; /Date(1146006000000)/<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // So I remove the forward slashes.<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var datePart = cellvalue.toString().replace("/", "");<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; datePart = datePart.replace("/", "");<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var dateValue = &#39;new &#39; + datePart + &#39;.toLocaleDateString()&#39;;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return eval(dateValue);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
</p>
<p>In the grid column, the date appears as &#39;26 March 2010&#39; for example. It appears correctly in the form when using GridToForm.</p>
<p>The SetRowData method fails on the line in bold with something like a "$ missing" error (can&#39;t remember the exact wording).</p>
</p>
<p>&#160;&#160;&#160; setRowData : function(rowid, data, cssp) {<br />&#160;&#160; &#160;&#160;&#160; &#160;var nm, success=false;<br />&#160;&#160; &#160;&#160;&#160; &#160;this.each(function(){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;var t = this, vl, ind, cp = typeof cssp;;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if(!t.grid) {return false;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;ind = t.rows.namedItem(rowid);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if(!ind) return false;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if( data ) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$(this.p.colModel).each(function(i){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;nm = this.name;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if( data[nm] != undefined) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;vl = t.formatter( rowid, data[nm], i, data, &#39;edit&#39;);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if(t.p.treeGrid===true &#38;&#38; nm == t.p.ExpandColumn) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;$("td:eq("+i+") &#62; span:first",ind).html(vl).attr("title",$.jgrid.stripHtml(vl));<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;} else {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <strong>&#160;$("td:eq("+i+")",ind).html(vl).attr("title",$.jgrid.stripHtml(vl)); </strong><br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;success = true;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;});<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if(cp === &#39;string&#39;) {$(ind).addClass(cssp);} else if(cp === &#39;object&#39;) {$(ind).css(cssp);}<br />&#160;&#160; &#160;&#160;&#160; &#160;});<br />&#160;&#160; &#160;&#160;&#160; &#160;return success;</p>
</p>
<p>Can you tell me what I&#39;m doing wrong please.</p>
</p>
<p>Regards,</p>
<p>Simon</p></p>
]]></description>
        	        	<pubDate>Fri, 26 Mar 2010 18:46:05 +0200</pubDate>
        </item>
</channel>
</rss>