<?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: how to overwrite savedRow when using tableToGrid?</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-overwrite-savedrow-when-using-tabletogrid</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/how-to-overwrite-savedrow-when-using-tabletogrid/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Akshitha on how to overwrite savedRow when using tableToGrid?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-overwrite-savedrow-when-using-tabletogrid#p15905</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-overwrite-savedrow-when-using-tabletogrid#p15905</guid>
        	        	<description><![CDATA[<p>Hi Tony,</p>
<p>&#160;&#160; I can achieve it in the following manner.</p>
<p style="padding-left: 30px;">&#160;</p>
<p style="padding-left: 30px;">$(&#39;#CCS&#39;).setGridParam({savedRow:null});<br />$(&#39;#CCS&#39;).setGridParam({savedRow:[]});</p>
<p style="padding-left: 30px;">$(&#39;#CCS&#39;).setGridParam({savedRow:[{"Id":$.trim($("#CCS").getCell(rowId,&#160;&#160;&#160; 0)),"Col1":$(&#39;input[name="Col1"]&#39;).val(),"Col2":$(&#39;input[name="Col2"]&#39;).val(),"Col3":$(&#39;input[name="Col3"]&#39;).val()}]});</p>
<p style="padding-left: 30px;">// Setting the row from editable to non-editable&#160; &#160;<br />$(&#39;#&#39;+rowId).attr("editable","0");</p>
<p style="padding-left: 30px;">// Updating the values<br />$(&#39;#&#39;+rowId+&#39;&#62;td:eq(1)&#39;).html($(&#39;input[name="Col1"]&#39;).val());</p>
<p style="padding-left: 30px;">$(&#39;#&#39;+rowId+&#39;&#62;td:eq(2)&#39;).html($(&#39;input[name="Col2"]&#39;).val());</p>
<p style="padding-left: 30px;">$(&#39;#&#39;+rowId+&#39;&#62;td:eq(3)&#39;).html($(&#39;input[name="Col3"]&#39;).val());</p>
<p style="padding-left: 30px;">&#160;// Resetting to empty, otherwise again the edit operation on the same row wont work. <br />lastSel="";</p>
<p style="padding-left: 30px;">&#160;</p>
]]></description>
        	        	<pubDate>Tue, 23 Mar 2010 14:35:12 +0200</pubDate>
        </item>
        <item>
        	<title>tony on how to overwrite savedRow when using tableToGrid?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-overwrite-savedrow-when-using-tabletogrid#p15726</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-overwrite-savedrow-when-using-tabletogrid#p15726</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Seems like there are no uniquie roiId&#39;s in the grid. Please check this</p>
<p>The savedRow is parameter of the grid so you can manipulate it with setGridParam and getGridParam</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Mon, 15 Mar 2010 20:41:13 +0200</pubDate>
        </item>
        <item>
        	<title>Akshitha on how to overwrite savedRow when using tableToGrid?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-overwrite-savedrow-when-using-tabletogrid#p15621</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-overwrite-savedrow-when-using-tabletogrid#p15621</guid>
        	        	<description><![CDATA[<p>Hi Tony,</p>
<p style="padding-left: 30px;">&#160;&#160; Am using tableToGrid function with Struts2. Am facing some issues when i try to update the row.Am doing Edit,Update &#38; Cancel operation using tableToGrid. Problem is after i update in case of successful updation, am returning only "success" message from server side as a json data. Then am trying to retain the entered value in the row cells. By using setRowData i can achieve this. Scenario not working is:<br />&#160;&#160;&#160; 1. Edit 1st row &#38; update it.<br />&#160;&#160;&#160; 2. Edit 2nd row &#38; cancel it.<br />&#160;&#160;&#160; 3. Edit again 1st row &#38; cancel it.<br />&#160;&#160;&#160; 4. Now if we edit any row, 1st row data changed to old value (as in edit function i&#39;ve written for restoring the last selected row).</p>
<p>&#160;&#160;&#160; is there any way to set savedRow data? so that i can overwrite it after i get success message from server in update method..</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;">My Code:</span></p>
<p style="padding-left: 30px;">&#160;</p>
<div class="sfcode" style="padding-left: 30px;">&#60;html&#62; <br />&#160;&#160;&#160; &#60;head&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#60;script type="text/javascript"&#62;</p>
<p>&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;var lastSel="";</p>
<p>&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(document).ready(function(){&#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; tableToGrid("#CCS",{altRows: true,<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; colModel:[ <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;Id&#39;,hidden:true},<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;Col1&#39;,align:"center",editable: true, editoptions:{name:"Col1"}},<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;Col2&#39;,align:"left",editable: true, editoptions:{name:"Col2"}},&#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; {name:&#39;Col3&#39;,align:"center",editable: true, editoptions:{name:"Col3"}},<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; {name:&#39;Action&#39;}<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; &#160;&#160;&#160; afterInsertRow: function(rowId, rowdata, rowelem) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $("#CCS").setCell(rowId,&#39;4&#39;,"&#60;input id=&#39;ed"+rowId+"&#39; type=&#39;button&#39; value=&#39;Edit&#39; onclick=&#39;javascript:edit("+rowId+")&#39; /&#62; &#60;input id=&#39;save"+rowId+"&#39; type=&#39;button&#39; value=&#39;Save&#39; onclick=&#39;javascript:save("+rowdata.Id+")&#39;/&#62; &#60;input id=&#39;can"+rowId+"&#39; type=&#39;button&#39; value=&#39;Cancel&#39; onclick=&#39;javascript:cancel("+rowId+")&#39; /&#62;",&#39;&#39;);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; jQuery("#save"+rowId+"").hide();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; jQuery("#can"+rowId+"").hide();<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; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; function edit(id) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; jQuery("#ed"+id+"").hide(); <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; jQuery("#save"+id+"").show(); <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; jQuery("#can"+id+"").show();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(id &#38;&#38; id!==lastSel){ <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#CCS&#39;).jqGrid(&#39;restoreRow&#39;,lastSel); <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; jQuery("#ed"+lastSel+"").show(); <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; jQuery("#save"+lastSel+"").hide();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; jQuery("#can"+lastSel+"").hide();<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; &#160;&#160;&#160; $(&#39;#CCS&#39;).jqGrid(&#39;editRow&#39;,id,true);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; lastSel=id; <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; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; function save(id){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $.post(&#39;&#60;s:url namespace="/test" action="update"/&#62;&#39;,<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; &#160;&#160;&#160; &#160;&#160;&#160; "Col1" : $(&#39;input[name="Col1"]&#39;).val(),<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; "Col2" : $(&#39;input[name="Col2"]&#39;).val(),<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; "Col3" : $(&#39;select[name="Col3"]&#39;).val(),<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; "Id":id<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; &#160;&#160;&#160; function(json) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(json.status == &#39;success&#39;){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#CCS&#39;).jqGrid(&#39;setRowData&#39;,id,{"Col1":$(&#39;input[name="Col1"]&#39;).val(),"Col2":$(&#39;input[name="Col2"]&#39;).val(),</p>
</div>
<div class="sfcode" style="padding-left: 30px;">"Col3":$(&#39;select[name="Col3"]&#39;).val()})<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; },<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; "json"<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; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; function cancel(id){<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#CCS&#39;).jqGrid(&#39;restoreRow&#39;,id);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; jQuery("#save"+id+"").hide();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; jQuery("#can"+id+"").hide();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; jQuery("#ed"+id+"").show(); <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; &#60;/script&#62;<br />&#160;&#160;&#160; &#60;/head&#62;</p>
<p>&#160;&#160;&#160; &#60;body&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#60;s:form &#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;table id="CCS"&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;thead&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;tr&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;th&#62;Id&#60;/th&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;th&#62;Col1&#60;/th&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;th&#62;Col2&#60;/th&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;th&#62;Col3&#60;/th&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;th&#62;Action&#60;/th&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;/tr&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;/thead&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;tbody&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;s:if test="beans.size &#62; 0"&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;s:iterator value="beans"&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;tr&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;td&#62;&#60;s:property value="id"/&#62;&#60;/td&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;td&#62;&#60;s:property value="col1"/&#62;&#60;/td&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;td&#62;&#60;s:property value="col2"/&#62;&#60;/td&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;td&#62;&#60;s:property value="col3"/&#62;&#60;/td&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;/tr&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;/s:iterator&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;/s:if&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;/tbody&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#60;/table&#62;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#60;/s:form&#62;<br />&#160;&#160;&#160; &#60;/body&#62;<br />&#60;/html&#62;</p>
</div>
<p style="padding-left: 30px;">&#160;</p>
]]></description>
        	        	<pubDate>Thu, 11 Mar 2010 15:22:20 +0200</pubDate>
        </item>
</channel>
</rss>