<?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: Inline editing: add not working after first time</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/inline-editing-add-not-working-after-first-time</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/inline-editing-add-not-working-after-first-time/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>jwklomp on Inline editing: add not working after first time</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/inline-editing-add-not-working-after-first-time#p28412</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/inline-editing-add-not-working-after-first-time#p28412</guid>
        	        	<description><![CDATA[<p>Dear Forum,</p>
</p>
<p>I&#39;m having a problem with adding new rows using inline editing. Delete and edit are going fine.</p>
<p>When I add the first new row it goes OK. Data is posted to the server when I press the &#39;save row&#39; button and the new row stays in the grid. However when I add a second new row, I can add the row and fill in the cells, but when I press the &#39;save row&#39; button nothing happens, the data is not posted to the server. I use jqGrid 4.4.4, but I also tried with 4.4.3 and this gives the same result.</p>
<p>I&#39;ve debugged the jquery.jqGrid.src.js (version 4.4.4)&#160;a bit and I think the problem is the following. &#160;The second time that I add a new row, in code line 9444 the rowID is set to <strong><span style="color: #0000ff;">&#39;jqg1&#39;</span></strong>, so the &#160;addClass("jqgrid-new-row") is applied to that row.</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5719' value='Select Code' data-codeid='sfcode5719' /></p>
<div class='sfcode' id='sfcode5719'>
<div class=&#34;sfcode&#34;>
<p>$($t).jqGrid(&#39;addRowData&#39;, p.rowID, p.initdata, p.position);</p>
<p>p.rowID = $t.p.idPrefix + p.rowID;</p>
<p>$(&#34;#&#34;+$.jgrid.jqID(p.rowID), &#34;#&#34;+$.jgrid.jqID($t.p.id)).addClass(&#34;jqgrid-new-row&#34;);&#160;</p>
</div>
</div>
<p>However in the part of the code that handles the onClick of the &#39;save&#39; button (line 9558), the rowID is set to <strong><span style="color: #0000ff;">&#39;jqg2</span></strong>&#39;. This row does not have the class jqgrid-new-row, so the &#39;else&#39; branche is taken.&#160;</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6830' value='Select Code' data-codeid='sfcode6830' /></p>
<div class='sfcode' id='sfcode6830'>
<p>if($(&#34;#&#34;+$.jgrid.jqID(sr), &#34;#&#34;+gID ).hasClass(&#34;jqgrid-new-row&#34;)) {</p>
<p style=&#34;padding-left: 30px;&#34;><span style=&#34;white-space: pre;&#34;> </span>o.editParams.extraparam[oper] = opers.addoper;</p>
<p>} else {</p>
<p style=&#34;padding-left: 30px;&#34;><span style=&#34;white-space: pre;&#34;> </span>o.editParams.extraparam[oper] = opers.editoper;</p>
<p>}</p>
</div>
<p>Is this because I&#39;m doing something wrong, or is it something in jqGrid?&#160;</p>
</p>
<p>This is the jqgrid code I am using (Note: I am using a dynamic column model that is generated by the server.)</p>
<pre><p><input type='button' class='sfcodeselect' name='sfselectit6029' value='Select Code' data-codeid='sfcode6029' /></p><div class='sfcode' id='sfcode6029'>       function showPropertiesTable(selectedFileSet) {
        var urlCall = "loadFileSet?fileSet=" + selectedFileSet;
        var grid = $("#properties_list")
        var lastSel = -1
        $.ajax({
            type : "GET",
            dataType : "json",
            url : urlCall,
            success : function(result) {
                var columnData = result.propertiesList // list of data
                , columnModel = result.colModelList; // column model list definition
                grid.jqGrid({
                    datatype : &#39;local&#39;,
                    data : columnData,
                    pager : &#39;#pager&#39;,
                    viewrecords : true,
                    rownumbers : true,
                    colModel : columnModel,
                    height : "auto",
                    autowidth : true,
                    editurl : &#39;editProperty&#39;,
                    beforeSelectRow : function(rowid) {
                        if (rowid !== lastSel) {
                            grid.jqGrid(&#39;restoreRow&#39;, lastSel);
                            lastSel = rowid;
                        }
                        return true;
                    },
                    rowNum : 20,
                    rowTotal : 2000,
                    rowList : [ 20, 30, 50 ],
                    loadonce : true,
                    loadError : function(xhr, status, error) {
                        alert(&#39;error&#39;);
                    }
                });
                grid.jqGrid(&#39;navGrid&#39;, "#pager", {
                    edit : false,
                    add : false,
                    del : true
                });
                grid.jqGrid(&#39;inlineNav&#39;, "#pager");
            },
            error : function(x, e) {
                alert(x.readyState + " " + x.status + " " + e.msg);
            }
        });
<br /></div></pre>
<pre></pre>
<p>Regards,&#160;</p>
</p>
<p>Jan-Willem Klomp</p>
]]></description>
        	        	<pubDate>Fri, 08 Mar 2013 10:45:48 +0200</pubDate>
        </item>
</channel>
</rss>