<?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: Master/Detail - onclickSubmit function is not been reloaded</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/masterdetail-onclicksubmit-function-is-not-been-reloaded</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/bugs/masterdetail-onclicksubmit-function-is-not-been-reloaded/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>camminati on Master/Detail - onclickSubmit function is not been reloaded</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/masterdetail-onclicksubmit-function-is-not-been-reloaded#p29282</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/masterdetail-onclicksubmit-function-is-not-been-reloaded#p29282</guid>
        	        	<description><![CDATA[<p>Hi and thank you for your answer,</p>
<p>I think I create the details grid exactly as in the example&#160; (<a title="http://trirand.com/blog/jqgrid/jqgrid.html" href="http://trirand.com/blog/jqgrid/jqgrid.html" target="_blank"></a><a href="http://trirand.com/blog/jqgrid" rel="nofollow" target="_blank">http://trirand.com/blog/jqgrid</a>.....qgrid.html -&#62; Advanced/Master Detail), only that I call it the first time from the onSelectRow and not from outside. I also checked that way, initializing the details grid empty for the first time, as in the example. Same thing.<img class="spSmiley" style="margin:0" title="Cry" src="/blog/wp-content/forum-smileys/sf-cry.gif" alt="Cry" /></p>
]]></description>
        	        	<pubDate>Tue, 06 Aug 2013 12:32:29 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Master/Detail - onclickSubmit function is not been reloaded</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/masterdetail-onclicksubmit-function-is-not-been-reloaded#p29281</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/masterdetail-onclicksubmit-function-is-not-been-reloaded#p29281</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>I&#39;m confused with a way you want to achieve this.</p>
</p>
<p>The first common error is that you create the grid every time you select a row.</p>
<p>This is wrong. When the grid is created, every call to the code agin will return nothing</p>
<p>$(&#39;#grid_d&#39;).jqGrid(skill_options(&#39;rest/developer/&#39; + row_id + &#39;/skills&#39;))</p>
<p>This will work only once.</p>
<p>In the demo we have a example just look on it.</p>
</p>
<p>Regards</p>
]]></description>
        	        	<pubDate>Tue, 06 Aug 2013 11:50:33 +0300</pubDate>
        </item>
        <item>
        	<title>camminati on Master/Detail - onclickSubmit function is not been reloaded</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/masterdetail-onclicksubmit-function-is-not-been-reloaded#p29261</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/masterdetail-onclicksubmit-function-is-not-been-reloaded#p29261</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I have a Master/Detail view in a page with two tables #grid and #grid_d. The table #grid_d shows the detail of the selected element in #grid. This is done rendering #grid_d in #grid.onSelectRow(). All info is loaded from a rest service.</p>
<p>The url to get #grid is /developers/ and the url to get #grid_d is /developer/DEV_ID/skills/. Hence when editing a detail row, the update url must be /developers/DEV_ID/skills/SKILL_ID.</p>
<p>In orther to do this, I get the current row_id in #grid.onSelectRow() and create a define function in #grid_d.onclickSubmit() which finaly puts both ids in the url together.</p>
<p>However, this works exactly only the first time, when #grid_d.onclickSubmit() is created first. Afterwards, all calls to #grid_d.onclickSubmit() will have the DEV_ID (row_id) from the first call (whatever you pick first). The SKILL_ID is correct.</p>
<p>I think there is a bug in reseting the function when the #grid_d is rendered for the second time, or is it a problem with the closure. If so, how should I be passing the DEV_ID instead?</p>
<p>In the code below, DEV_ID is the id from the #grid model, and SKILL_ID is the topic.id from the #grid_d model.I used jquery-1.10.2 and 1.9.1,&#160; jqGrid&#160; 4.4.5 and jqGrid&#160; 4.5.2 .. all the same.</p>
<p>/* <br />&#160;* @camminati<br />&#160;* developers_bug1.js<br />&#160;*/</p>
<p>$(function() {</p>
<p>&#160; var URL = &#39;rest/developer&#39;;<br />&#160; var developer_editOptions = {<br />&#160;&#160;&#160; onclickSubmit: function(params, postdata) {<br />&#160;&#160;&#160;&#160;&#160; params.url = URL + &#39;/&#39; + postdata.id;<br />&#160;&#160;&#160; }<br />&#160; };<br />&#160; var developer_addOptions = {mtype: &#39;POST&#39;};<br />&#160; var developer_delOptions = {<br />&#160;&#160;&#160; onclickSubmit: function(params, postdata) {<br />&#160;&#160;&#160;&#160;&#160; params.url = URL + &#39;/&#39; + postdata;<br />&#160;&#160;&#160; }<br />&#160; };</p>
<p>&#160; var skill_options = function(in_url) {<br />&#160;&#160;&#160; return {url: in_url,<br />&#160;&#160;&#160;&#160;&#160; datatype: &#39;json&#39;,<br />&#160;&#160;&#160;&#160;&#160; height: &#39;auto&#39;,<br />&#160;&#160;&#160;&#160;&#160; colModel: [<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name: &#39;topic.id&#39;, label: &#39;id&#39;, width: 60, hidden: false},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name: &#39;topic.name&#39;, label: &#39;Name&#39;, width: 100, editable: false},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name: &#39;value&#39;, label: &#39;Qualification&#39;, width: 20, editable: true},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name: &#39;topic.description&#39;, label: &#39;Description&#39;, width: 200, editable: false},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name: &#39;topic.category&#39;, label: &#39;Category&#39;, width: 100, editable: false}<br />&#160;&#160;&#160;&#160;&#160; ],<br />&#160;&#160;&#160;&#160;&#160; pager: &#39;#pager_d&#39;,<br />&#160;&#160;&#160;&#160;&#160; caption: &#39;Skills&#39;,<br />&#160;&#160;&#160;&#160;&#160; recreateForm: true,<br />&#160;&#160;&#160;&#160;&#160; reloadAfterSubmit: false<br />&#160;&#160;&#160; };<br />&#160; };</p>
<p>&#160; var developers_options = {<br />&#160;&#160;&#160; url: URL,<br />&#160;&#160;&#160; editurl: URL,<br />&#160;&#160;&#160; datatype: &#39;json&#39;,<br />&#160;&#160;&#160; colModel: [<br />&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; name: &#39;id&#39;, label: &#39;ID&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; width: 200,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; editable: false,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; editoptions: {disabled: true, size: 0}<br />&#160;&#160;&#160;&#160;&#160; },<br />&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; name: &#39;email&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; label: &#39;email&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; width: 300,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; editable: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; editoptions: {disabled: false, size: 0}<br />&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; ],<br />&#160;&#160;&#160; caption: &#39;Developers&#39;,<br />&#160;&#160;&#160; pager: &#39;#pager&#39;,<br />&#160;&#160;&#160; height: &#39;auto&#39;,<br />&#160;&#160;&#160; onSelectRow: function(row_id) {<br />&#160;&#160;&#160;&#160;&#160; console.log(&#39;onSelectRow: function(row_id)&#39;, row_id);<br />&#160;&#160;&#160;&#160;&#160; $("#grid_d").jqGrid(&#39;setGridParam&#39;, {url: &#39;rest/developer/&#39; + row_id + &#39;/skills&#39;});<br />&#160;&#160;&#160;&#160;&#160; $(&#39;#grid_d&#39;).jqGrid(skill_options(&#39;rest/developer/&#39; + row_id + &#39;/skills&#39;))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .navGrid(&#39;#pager_d&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {}, //options&#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; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //editOptions<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mtype: "PUT",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; reloadAfterSubmit: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; onclickSubmit: function(params, postdata) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var details_rowdata = jQuery(&#39;#grid_d&#39;).getRowData();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var gridId = postdata[&#39;grid_d_id&#39;];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; console.log(&#39;skill_editOptions onclickSubmit id-&#62;&#39;, row_id);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; params.url = &#39;rest/developer/&#39; + row_id + &#39;/skills/&#39; + details_rowdata[gridId - 1][&#39;topic.id&#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; },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {}, //addoptions<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {}, //deloprions<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {} // search options<br />&#160;&#160;&#160;&#160;&#160; ).trigger(&#39;reloadGrid&#39;);<br />&#160;&#160;&#160; }<br />&#160; };</p>
<p>&#160; $(&#39;#grid&#39;)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .jqGrid(developers_options)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .navGrid(&#39;#pager&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {}, //options<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; developer_editOptions,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; developer_addOptions,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; developer_delOptions,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {} // search options&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160; );</p>
<p>});</p>
</p>
<p>And the html:</p>
<p>&#60;!DOCTYPE html&#62;<br />&#60;html&#62;<br />&#160;&#160;&#160; &#60;head&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;title&#62;&#60;/title&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;link rel="stylesheet" type="text/css" media="screen" href="css/jquery-ui-1.10.2.custom.min.css" /&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" /&#62;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;script type="text/JavaScript" src="js/jquery-1.10.2.js"&#62;&#60;/script&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;script src="js/grid.locale-en.js" type="text/javascript"&#62;&#60;/script&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;script src="js/jquery.jqGrid.src.js" type="text/javascript"&#62;&#60;/script&#62;&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;script src="js/jqGrid_defaults.js" type="text/javascript"&#62;&#60;/script&#62;&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160; &#60;/head&#62;<br />&#160;&#160;&#160; &#60;body&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;table id="grid"&#62;&#60;/table&#62; &#60;div id="pager"&#62;&#60;/div&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;br/&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;table id="grid_d"&#62;&#60;/table&#62;&#60;div id="pager_d"&#62;&#60;/div&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;script src="js/developers_bug1.js"&#62;&#60;/script&#62;<br />&#160;&#160;&#160; &#60;/body&#62;<br />&#60;/html&#62;</p>
]]></description>
        	        	<pubDate>Fri, 02 Aug 2013 11:36:07 +0300</pubDate>
        </item>
</channel>
</rss>