<?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: Weird cell editing behavior</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/weird-cell-editing-behavior</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/weird-cell-editing-behavior/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>metaGlass on Weird cell editing behavior</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/weird-cell-editing-behavior#p26963</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/weird-cell-editing-behavior#p26963</guid>
        	        	<description><![CDATA[<p>I figured it out 🙂 I didn&#39;t need to invoke "cellSave" in my keypress cases. &#160;Ultimately, I ended up removing dataInit and dataEvents all together, and just utilizing afterEditCell to select the input element and bind my own event handlers. &#160;It was just less code and seemed cleaner that way for the time being.</p>
]]></description>
        	        	<pubDate>Wed, 18 Jul 2012 06:15:03 +0300</pubDate>
        </item>
        <item>
        	<title>metaGlass on Weird cell editing behavior</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/weird-cell-editing-behavior#p26962</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/weird-cell-editing-behavior#p26962</guid>
        	        	<description><![CDATA[<p>In the switch statement, within cases 9 and 13, this is the line where it causes the weird behavior:</p>
</p>
<p>theGrid.Instance.jqGrid("editCell", ++theGrid.CurrentRowEditing, --theGrid.CurrentColEditing, true);</p>
</p>
<p>If I set the last parameter to false, it doesn&#39;t screw up. &#160;However, I need it to go into edit mode when they tab-or-enter into the next cell.</p>
]]></description>
        	        	<pubDate>Wed, 18 Jul 2012 03:24:47 +0300</pubDate>
        </item>
        <item>
        	<title>metaGlass on Weird cell editing behavior</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/weird-cell-editing-behavior#p26961</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/weird-cell-editing-behavior#p26961</guid>
        	        	<description><![CDATA[<p>Sorry about the bad code formatting and lack of indentation. &#160;Let me know if it&#39;s a problem and I&#39;ll see if I can some how post something that&#39;s easier to read and figure out. &#160;Also, there are any questions about the code snippets, please feel free to ask.</p>
]]></description>
        	        	<pubDate>Wed, 18 Jul 2012 03:22:43 +0300</pubDate>
        </item>
        <item>
        	<title>metaGlass on Weird cell editing behavior</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/weird-cell-editing-behavior#p26960</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/weird-cell-editing-behavior#p26960</guid>
        	        	<description><![CDATA[<p>Hello,</p>
</p>
<p>I&#39;m having a weird cell editing problem. &#160;So the basic configuration is a grid with 10 columns, the first column being a hidden ID colum. &#160;The grid is in cellEdit mode with cellsubmit set to clientArray. &#160;Only two columns are editable (in this case, column indexes 5 and 6). &#160;The request from my client is to make it behave as close to Excel as possible (try to contain your shock and amazement ;).</p>
</p>
<p>Anyway, it&#39;s fairly straightforward. &#160;If in column 5 and they hit tab, it should save the current cell and move over to editing column 6 on the same row. &#160;If they hit enter instead of tab, then it saves the cell and moves down a row in the same column. &#160;If they are in column 6 and hit tab, then it saves the cell and moves onto editing the cell on the next row in column 5. &#160;If they hit enter, then it just moves down a row and stays in column 6. &#160;In any of those cases, hitting tab or enter will cause the current cell to be saved and then moved onto editing the appropriate cell according to the rules above.</p>
</p>
<p>My problem is that when in column 6, and the user hits tab, instead of saving the current cell and moving on to edit column 5 on the next row, it seems to clear the value in the current cell and moves onto the next row. &#160;It&#39;s really odd. &#160;I have narrowed the line where it screws up to be the call to editCell right after saveCell in dataEvents (in either handlers, for tab or enter). &#160;One of the other columns has to be recalculated after every cell edit. &#160;When the behavior screws up like this, the recalculated column outputs &#39;NaN&#39;, which would lead me to believe that there&#39;s some invalid data in the last edited cell. &#160;In the code snippet below, theGrid is a global instance of the grid that was saved upon initilization. &#160;theGrid.CurrentRowEditing and theGrid.CurrentColEditing are global numeric variables that keep track of the cell being edited. &#160;It is updated in beforeCellEdit and set to the iRow and iCol that was passed into that handler.</p>
</p>
<p>Any feedback that would help me in debugging this issue would be greatly appeciated! Thank you! 🙂</p>
</p>
<p>The code snippet is as follows:</p>
</p>
<p>[...the colModel...]</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6454' value='Select Code' data-codeid='sfcode6454' /></p>
<div class='sfcode' id='sfcode6454'>{ name: &#39;UnitsPerBox&#39;, index: &#39;UnitsPerBox&#39;, width: AppOptions.theGridColW[7], editable: false },			{ name: &#39;Shipment2&#39;, index: &#39;Shipment2&#39;, width: AppOptions.theGridColW[6], editable: true, editoptions: { dataInit: this.dataInit, dataEvents: this.dataEvents } },			{ name: &#39;Shipment1&#39;, index: &#39;Shipment1&#39;, width: AppOptions.theGridColW[5], editable: true, editoptions: { dataInit: this.dataInit, dataEvents: this.dataEvents } },{ name: &#39;Suggested&#39;, index: &#39;Suggested&#39;, width: AppOptions.theGridColW[4], editable: false }</div>
</p>
<p>[...dataInit...]</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6061' value='Select Code' data-codeid='sfcode6061' /></p>
<div class='sfcode' id='sfcode6061'>this.dataInit = function(elem) { $(elem).focus(function() { this.select(); }); };</div>
</p>
<p>[...dataEvents...]</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1138' value='Select Code' data-codeid='sfcode1138' /></p>
<div class='sfcode' id='sfcode1138'>
<p>this.dataEvents = [</p>
<p>{</p>
<p>type: &#34;keydown&#34;,</p>
<p>fn: function(e) {</p>
<p>var key = e.charCode &#124;&#124; e.keyCode;</p>
<p>switch (key) {</p>
<p>case 9: {	// Tab</p>
<p>if (theGrid.CurrentColEditing == 6) {</p>
<p>theGrid.Instance.jqGrid(&#34;saveCell&#34;, theGrid.CurrentRowEditing, theGrid.CurrentColEditing);</p>
<p>theGrid.Instance.jqGrid(&#34;editCell&#34;, ++theGrid.CurrentRowEditing, --theGrid.CurrentColEditing, true);</p>
<p>}</p>
<p>break;</p>
<p>}</p>
<p>case 13: {	// Enter</p>
<p>theGrid.Instance.jqGrid(&#34;saveCell&#34;, theGrid.CurrentRowEditing, theGrid.CurrentColEditing);</p>
<p>theGrid.Instance.jqGrid(&#34;editCell&#34;, (theGrid.CurrentRowEditing + 1), theGrid.CurrentColEditing, true);</p>
<p>break;</p>
<p>}</p>
<p>case 27: {	// Escape</p>
<p>theGrid.Instance.jqGrid(&#34;restoreCell&#34;, theGrid.CurrentRowEditing, theGrid.CurrentColEditing);</p>
<p>break;</p>
<p>}</p>
<p>case 35: { // End</p>
<p>break;</p>
<p>}</p>
<p>case 36: {	// Home</p>
<p>break;</p>
<p>}</p>
<p>case 37: {	// Left</p>
<p>break;</p>
<p>}</p>
<p>case 38: {	// Up</p>
<p>break;</p>
<p>}</p>
<p>case 39: {	// Right</p>
<p>break;</p>
<p>}</p>
<p>case 40: {	// Down</p>
<p>break;</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>];</p>
</div>
]]></description>
        	        	<pubDate>Wed, 18 Jul 2012 03:21:06 +0300</pubDate>
        </item>
</channel>
</rss>