<?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: 'selrow' parameter invalid for Cell Editing</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/selrow-parameter-invalid-for-cell-editing</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/selrow-parameter-invalid-for-cell-editing/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>nisrak on 'selrow' parameter invalid for Cell Editing</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/selrow-parameter-invalid-for-cell-editing#p27084</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/selrow-parameter-invalid-for-cell-editing#p27084</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>I have a jqGrid set up with cell editing and everything is working great! I am using custom editrules that perform ajax calls to do custom validation.&#160; To perform this validation, I am using the following command to get id of the row that is being edited:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7830' value='Select Code' data-codeid='sfcode7830' /></p>
<div class='sfcode' id='sfcode7830'>var rowId = jQuery(&#34;#capacity_list&#34;).getGridParam(&#39;selrow&#39;);</div>
<p>The problem I am having is that when I edit a cell and then click on another row (thus causing the cell to save), the validation gets the rowId of the newly clicked on cell because the editrules function is firing after the selected row changes.&#160; Is there another way to get rowId that avoids this problem?</p>
</p>
<p>Below is an example of my code:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2770' value='Select Code' data-codeid='sfcode2770' /></p>
<div class='sfcode' id='sfcode2770'>
<p>jQuery(&#34;#capacity_list&#34;).jqGrid({</p>
<p>...</p>
<p>colModel: [</p>
<p>&#160;&#160;&#160; {name:&#39;currentCapacity&#39;, width:50, editable:true, editrules:{number:true, &#34;custom&#34;:true, &#34;custom_func&#34;:validateCapExpand}},</p>
<p>...</p>
<p>&#160;function validateCapExpand(data, value) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var result = [true, &#39;&#39;];</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; var rowId = jQuery(&#34;#capacity_list&#34;).getGridParam(&#39;selrow&#39;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(rowId) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; jQuery.ajax({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; async: false,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; url: &#39;asset/validateCapExpand&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data: { currentCapacity: data, assetId: ${assetInstance.id}, rowId: rowId },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dataType: &#39;json&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; contentType: &#39;application/json; charset=utf-8&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; success: function(data) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(data.retVal) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; result = [true, &#39;&#39;]<br />&#160;&#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;&#160;&#160;&#160; result= [false, &#39; is greater than max expandable&#39;];<br />&#160;&#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; error: function () { alert(&#39;Error trying to validate&#39;); }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; });<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; return result;<br />&#160;&#160;&#160; }</p>
</div>
<p>Thanks for any help!</p>
<p>- Nisrak</p>
]]></description>
        	        	<pubDate>Tue, 07 Aug 2012 04:29:31 +0300</pubDate>
        </item>
</channel>
</rss>