<?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: Losing cell edits when paging with local data.</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/losing-cell-edits-when-paging-with-local-data</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/losing-cell-edits-when-paging-with-local-data/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>WarrenW on Losing cell edits when paging with local data.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/losing-cell-edits-when-paging-with-local-data#p20853</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/losing-cell-edits-when-paging-with-local-data#p20853</guid>
        	        	<description><![CDATA[<p>Hi.</p>
<p>I&#39;m either missing something or I&#39;ve found a bug in cell editing when using paging with local datatype.&#160; Could someone help me see why this isn&#39;t working?&#160; Here&#39;s an example of my grid that has two rows, 7 columns, and 2 pages.</p>
<blockquote>
<p>&#60;?xml version="1.0" encoding="utf-8" ?&#62;</p>
<p>&#60;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <br />&#160;&#160; &#160;"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&#62;</p>
<p>&#60;html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/"&#62;</p>
<p>&#60;head&#62;</p>
<p>&#60;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&#62;<br />&#60;meta http-equiv="X-UA-Compatible" content="IE=8" /&#62;</p>
<p>&#60;link href="style/common.css" rel="stylesheet" type="text/css" /&#62;<br />&#60;link href="style/redmond/jquery-ui-1.8.5.custom.css" rel="stylesheet" type="text/css" /&#62;<br />&#60;link href="style/ui.jqgrid.css" rel="stylesheet" type="text/css" /&#62;</p>
<p>&#60;script src="script/jquery-1.4.2.js" type="text/javascript"&#62;&#60;/script&#62;<br />&#60;script src="script/jquery-ui-1.8.5.custom.js" type="text/javascript"&#62;&#60;/script&#62;<br />&#60;script src="script/grid.locale-en.js" type="text/javascript"&#62;&#60;/script&#62;<br />&#60;script src="script/jquery.jqGrid-3.8.1.min.js" type="text/javascript"&#62;&#60;/script&#62;</p>
<p>&#60;/head&#62;</p>
<p>&#60;body&#62;<br />&#60;table id="grid"&#62;&#60;/table&#62;<br />&#60;div id="gridnav"&#62;&#60;/div&#62;</p>
<p>&#60;script&#62;<br />$(function() {</p>
<p>var colModel = [];<br />colModel.push({<br />&#160;&#160; &#160;align: "center",<br />&#160;&#160; &#160;label : "Cat.",<br />&#160;&#160; &#160;name : "cat",<br />&#160;&#160; &#160;sortable: false<br />});</p>
<p>colModel.push({<br />&#160;&#160; &#160;hidden : true,<br />&#160;&#160; &#160;name : week<br />});</p>
<p>for (var i = 0; i &#60; 7; i++) {<br />&#160;&#160; &#160;colModel.push({<br />&#160;&#160; &#160;&#160;&#160; &#160;align : "center",<br />&#160;&#160; &#160;&#160;&#160; &#160;editable: true,<br />&#160;&#160; &#160;&#160;&#160; &#160;editrules: {number: true},<br />&#160;&#160; &#160;&#160;&#160; &#160;label: "day" + i,<br />&#160;&#160; &#160;&#160;&#160; &#160;name : "day" + i,<br />&#160;&#160; &#160;&#160;&#160; &#160;sortable: false<br />&#160;&#160; &#160;});<br />}</p>
<p>var category = [ "A", "B" ];</p>
<p>var data = [];</p>
<p>for (var week = 0; week &#60; 2; week++) {<br />&#160;&#160; &#160;$.each(category, function(index, shift) {<br />&#160;&#160; &#160;&#160;&#160; &#160;var rowdata = { cat : category[index], week: week };<br />&#160;&#160; &#160;&#160;&#160; &#160;for (var day = 0; day &#60; 7; day++) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;rowdata["day"+day] = ""+week;<br />&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;data.push(rowdata);<br />&#160;&#160; &#160;});<br />}</p>
<p>var grid = $(&#39;#grid&#39;);<br />var gridnavref = &#39;#gridnav&#39;;</p>
<p>grid.jqGrid({<br />&#160;&#160; &#160;caption: "Sample",<br />&#160;&#160; &#160;cellEdit: true,<br />&#160;&#160; &#160;cellsubmit: "clientArray",<br />&#160;&#160; &#160;colModel: colModel,<br />&#160;&#160; &#160;data: data,<br />&#160;&#160; &#160;datatype: "local",<br />&#160;&#160; &#160;hidegrid: false,<br />&#160;&#160; &#160;pager: gridnavref,<br />&#160;&#160; &#160;pgtext: "week {0} of {1}",<br />&#160;&#160; &#160;rowNum: 2<br />});</p>
<p>});</p>
<p>&#60;/script&#62;</p>
<p>&#60;/body&#62;</p>
<p>&#60;/html&#62;</p>
</blockquote>
<p>If you go to each page, you can see the data is populated with all 0&#39;s for the first page and all 1&#39;s for the second page.&#160; If you try editing one of the cells, you&#39;ll see that the data is edited just fine as long as you stay on the page.&#160; If you go to the other page and back to the original page, you&#39;ll see that all the edits are gone.&#160; Reading some previous posts, I&#39;ve tried with and without the trigger("reload") and I&#39;m getting the same problem.&#160; Can someone tell me what&#39;s wrong?&#160; Am I missing an option?&#160; Am I not populating the data array properly?</p>
</p>
<p>Thanks.</p>
</p>
<p>Warren</p>
]]></description>
        	        	<pubDate>Tue, 16 Nov 2010 19:17:12 +0200</pubDate>
        </item>
</channel>
</rss>