<?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: Key data needs to be added to Detail rows of Master/Detail grids</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids</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/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Sloan on Key data needs to be added to Detail rows of Master/Detail grids</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9282</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9282</guid>
        	        	<description><![CDATA[</p>
<p><span style="text-decoration: underline;"><strong><span style="color: #ff0000;">Thank You! Thank You! Thank You! Thank You! Thank You!</span></strong></span>&#160;</p>
</p>
<p>I tried to get onclickSubmit working for a couple of days. I didn&#39;t realize that it went inside the navGrid. That&#39;s such a great help!</p>
<p>After reading your post, I got it up and running in about 30 minutes</p>
<p>Again, thank you for your help and your patience!</p>
</p>
<p>Sloan</p>
]]></description>
        	        	<pubDate>Thu, 03 Sep 2009 14:39:42 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on Key data needs to be added to Detail rows of Master/Detail grids</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9254</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9254</guid>
        	        	<description><![CDATA[<p>Hi Sloan,</p>
</p>
<p>it&#39;s a little another problem, but it could be also easy solved. You can add in you edit/add options as a parameter of navGrid a function onclickSubmit in your Detail grid. For example,</p>
<p>var grid = jQuery(&#39;#master&#39;).jqGrid({</p>
<p>...</p>
<p>var urlEditDetail=&#39;ColEdit_XML.asp&#39;;</p>
<p>var gridDetails = jQuery(&#39;#detail&#39;).jqGrid({</p>
<p>...</p>
<p>}).navGrid(&#39;#ColPager&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // navGridOptions:<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {add:true,edit:true,del:true},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Edit options:<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {onclickSubmit: function(rp_ge, postdata) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var sel_testcluster_id = grid.getGridParam(&#39;selrow&#39;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rp_ge.url = urlEditDetail + &#39;/&#39; + sel_testcluster_id;<br />&#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;&#160;&#160; // Add options:<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {onclickSubmit: function(rp_ge, postdata) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var sel_testcluster_id = grid.getGridParam(&#39;selrow&#39;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rp_ge.url = urlEditDetail + &#39;/&#39; + sel_testcluster_id;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }});</p>
<p>So you add onclickSubmit in Edit/Add navigation bar of the Detail grid. If the event take palce, you get Id of from selected row of Master grid and place if either as a part of postdata or in the url like in my example.</p>
</p>
<p>Best regards</p>
<p>Oleg</p>
]]></description>
        	        	<pubDate>Thu, 03 Sep 2009 06:32:03 +0300</pubDate>
        </item>
        <item>
        	<title>Sloan on Key data needs to be added to Detail rows of Master/Detail grids</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9253</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9253</guid>
        	        	<description><![CDATA[<p>Thanks Oleg,</p>
<p>But the problem is that when jqGrid sends the added row to the server, the data has to include the key of the master table row.</p>
<p><strong>For Example:</strong></p>
<div style="padding-left:5px;margin-left:10px;border-top:solid 1px #000000;border-right:solid 1px #000000;border-bottom:solid 1px #000000;border-left:solid 1px #000000;background-color:#ffffd0;">
<p style="background-color:#ffffd0;">Master data:</p>
<p style="background-color:#ffffd0;">&#160;&#160;&#160;&#160;ID, DBName, TableName,&#160; Description</p>
<p style="background-color:#ffffd0;"><em>In this case, ID is a unique ID for the Master table</em></p>
<hr style="color:#ff0000;" />
<p style="background-color:#ffffd0;">Detail Data:</p>
<p style="background-color:#ffffd0;">&#160;&#160;&#160;&#160;ID, Master_DBName, Master_TableName,&#160; FieldName, FldType, etc.</p>
<p style="background-color:#ffffd0;"><em>In this case, ID is a unique ID for the Detail table</em></p>
<hr style="color:#ff0000;" />
<p style="background-color:#ffffd0;">Where DB_Name = Master_DBName and TableName = Master_TableName</p>
</div>
<p>When jqGrid adds a row, Master_DBName and Master_TableName are blank (as with all the row&#39;s fields), so I need to be able to insert the proper key from the master grid/table. Otherwise, the asp file on the server won&#39;t know which master record to associate with the detail row.</p>
<p>In other words, I need to populate the fields <strong><em>before</em></strong> the data is sent to the server.</p>
<p>Also, I&#39;ll need to get the value(s) of the parent key fields of existing rows in order to figure out the value to put into these parent key fields. I saw an XML example where user data was passed outside the rows, in the same area where things like the page number and such are located. That might be the way to pass the parent key to the grid. (all rows in the detail grid would have the same parent keys).</p>
<p>Sorry to be so slow, and thanks for your patience!</p>
<p>Sloan</p></p>
]]></description>
        	        	<pubDate>Thu, 03 Sep 2009 06:00:13 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on Key data needs to be added to Detail rows of Master/Detail grids</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9247</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9247</guid>
        	        	<description><![CDATA[<p>Hello Sloan,</p>
</p>
<p>I see different ways which can help you. First of all, if new row added send to server, server must returns back at least id. So, you can use one constructed parameter (tdr_ID + &#39;_&#39; + tdr_td_DB). Id will be always sending to server and back and id must be not a part of colModel at all. If tdr_td_DB is nullable, you can use strings like (tdr_ID + &#39;_NULL&#39;) in such cases. They will be unique and can be an id. And such constructed Ids can be easy decoded to your real two Ids by server.</p>
<p>Second, if server generates or updates more data fields after data modification, you can use afterSubmit function, which be called by navGrid after Add or Edit action. If one version of such function enough for you in your whole program, you can set with so way:</p>
</p>
<p>$.extend($.jgrid.edit, {..., afterSubmit: function(response, postdata) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var res = $.secureEvalJSON(response.responseText);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (typeof res === "string") {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; postdata.RowVersion = res;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return [true, ""];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#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; postdata.RowVersion = res.RowVersion;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return [true, "", res.Id];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }, ...});</p>
<p>or you can set it directly as a parameter of navGrid function:</p>
<p>jQuery(&#8221;#ColumnList&#8221;).jqGrid({ <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; url:&#39;ColGrid_XML.asp&#39;, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; editurl: &#39;ColEdit_XML.asp&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: &#39;xml&#39;, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; mtype: &#39;POST&#39;,</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; .....</p>
<p>caption: &#39;Columns&#39;</p>
<p>&#160;&#160;&#160; }).navGrid(&#39;#ColPager&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {add:true,edit:true,del:true,width:&#39;400px&#39;},&#160; // navGridOptions<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {},&#160;&#160; // Edit options<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {afterSubmit = function(response, postdata) {<br />&#160; &#160; &#160; &#160; &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var res = $.secureEvalJSON(response.responseText);<br />&#160; &#160; &#160; &#160; &#160; &#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; postdata.RowVersion = res.RowVersion;<br />&#160; &#160; &#160; &#160; &#160; &#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return [true, "", res.Id];<br />&#160; &#160; &#160; &#160; &#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160; }});&#160; // Add options</p>
<p>In the example serever send back to the client JSON encoded data Id and RowVersion (timestamp of data row, which I use for concurency check).&#160; Global version of afterSubmit detects Add or Edit situation based on respond data type. My server send back a string with RowVersion value back for the Edit action and an Object {Id,RowVersion} as a response to Add action. You can solve your problem with a close way.</p>
</p>
<p>Regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Thu, 03 Sep 2009 02:54:26 +0300</pubDate>
        </item>
        <item>
        	<title>Sloan on Key data needs to be added to Detail rows of Master/Detail grids</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9246</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9246</guid>
        	        	<description><![CDATA[<p>Thanks Oleg.</p>
<p>That helps on edit, but those two fields are empty when a new row is added.</p>
<p>So I still need to find a way to populate them when the form is called, or just after the submit button is clicked on the form.</p>
</p>
<p>Thanks!</p>
</p>
<p>Sloan</p></p>
]]></description>
        	        	<pubDate>Thu, 03 Sep 2009 00:20:25 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on Key data needs to be added to Detail rows of Master/Detail grids</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9238</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9238</guid>
        	        	<description><![CDATA[<p>Hi Sloan!</p>
</p>
<p>It seems to me, if you&#39;ll use "hidden: true, editable: true, editrules: { edithidden: false}" instead of "editable: false,hidden:true", your problem will be solved.</p>
</p>
<p>Regards</p>
<p>Oleg</p>
]]></description>
        	        	<pubDate>Wed, 02 Sep 2009 17:37:53 +0300</pubDate>
        </item>
        <item>
        	<title>Sloan on Key data needs to be added to Detail rows of Master/Detail grids</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9235</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/key-data-needs-to-be-added-to-detail-rows-of-masterdetail-grids#p9235</guid>
        	        	<description><![CDATA[<p>I&#39;ve got a master/detail pair of grids. There is a parent key(actually 2 fields) in the detail grid, referring to the corresponding row in the master grid. In the detail grid, I have these fields hidden and not editable.</p>
<p>When adding or editing a row, neither field is included in the data sent to the server. Here&#39;s the code for the detail table:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9669' value='Select Code' data-codeid='sfcode9669' /></p>
<div class='sfcode' id='sfcode9669'>&#160;&#160;&#160; jQuery(&#8221;#ColumnList&#8221;).jqGrid({ <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; url:&#39;ColGrid_XML.asp&#39;, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; editurl: &#39;ColEdit_XML.asp&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: &#39;xml&#39;, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; mtype: &#39;POST&#39;, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; colNames:[&#39;ID&#39;,&#39;DB&#39;,&#39;Table&#39;,&#39;Order&#39;,&#39;Name&#39;,&#39;Type&#39;,&#39;Size&#39;,&#39;Default&#39;,&#39;Nulls?&#39;,&#39;Indexed?&#39;,&#39;Updated&#39;,&#39;Created&#39;], <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; colModel :[ <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;tdr_ID&#39;, index:&#39;tdr_ID&#39;, width:0,search:false, editable: false,hidden:true}, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;tdr_td_DB&#39;, index:&#39;tdr_td_DB&#39;,width:0,sortable:false,search:false, editable: false,hidden:false}, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;tdr_td_Name&#39;, index:&#39;tdr_td_Name&#39;, width:0,sortable:false,search:false, editable: false,hidden:false}, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;tdr_RowOrder&#39;, index:&#39;tdr_RowOrder&#39;, width:35, align:&#39;left&#39;,search:false, editable: true,editrules:{edithidden:false, required:false, integer:true, minValue:0},editoptions:{size:"20",maxlength:"20"}},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;tdr_Name&#39;, index:&#39;tdr_Name&#39;, width:140, align:&#39;left&#39;,search:true,sortable:false, editable:true, edittype:&#39;text&#39;,editoptions:{size:"20",maxlength:"20"}}, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;tdr_Type&#39;, index:&#39;tdr_Type&#39;, width:120, align:&#39;left&#39;,search:true,sortable:false, editable:true, edittype:&#39;select&#39;,editoptions:{value:&#39;int:int;number:number (Enter Decimals in Size);varchar:varchar (Enter Length in Size);text:Text;date:date;identity:(Special) Identity;parentid:(Special) Parent ID;updated:(Special) Date Last Updated;created:(Special) Date Created&#39;}}, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;tdr_Size&#39;, index:&#39;tdr_Size&#39;, width:120, align:&#39;center&#39;,search:false,sortable:false, editable:true, edittype:&#39;text&#39;,editoptions:{size:"10",maxlength:"20"}},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;tdr_Default&#39;, index:&#39;tdr_Default&#39;, width:80, align:&#39;center&#39;,search:false,sortable:false, editable:true, edittype:&#39;text&#39;,editoptions:{size:"30",maxlength:"20"}}, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;tdr_Nulls&#39;, index:&#39;tdr_Nulls&#39;, width:60, align:&#39;center&#39;,search:false, editable:true,formatter:&#39;checkbox&#39;,edittype:"checkbox", editoptions:{value:"Y:N"},sortable:false},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;tdr_Indexed&#39;, index:&#39;tdr_Indexed&#39;, width:60, align:&#39;center&#39;,search:false, editable:true,formatter:&#39;checkbox&#39;,edittype:"checkbox", editoptions:{value:"Y:N"},sortable:false},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;tdr_Updated&#39;, index:&#39;tdr_Updated&#39;, width:120, align:&#39;center&#39;,search:false, sorttype:&#39;date&#39;, datefmt:&#39;Y-m-d&#39;, editable:false,sortable:false}, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;tdr_Created&#39;, index:&#39;tdr_Created&#39;, width:120, align:&#39;center&#39;,search:false, sorttype:&#39;date&#39;, datefmt:&#39;Y-m-d&#39;, editable:false,sortable:false} ], <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; pager: jQuery(&#39;#ColPager&#39;), <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowNum:10, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowList:[5,10,20,30,50], <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; height:&#39;230px&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; altRows:true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; multiselect:false,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; hiddengrid:false,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortname: &#39;tdr_id&#39;, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortorder: &#39;asc&#39;, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; closeAfterAdd:true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; closeAfterEdit:true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; multiselect:false,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; imgpath: &#39;img/images&#39;, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; caption: &#39;Columns&#39;<br />&#160;&#160;&#160; }).navGrid(&#39;#ColPager&#39;,{add:true,edit:true,del:true,width:&#39;400px&#39;});</div>
</p>
<p>The fields tdr_td_DB and tdr_td_Name are the fields that link back to the parent table. I tried adding onClickSubmit, which doesn&#39;t seem to ever be called. I&#39;ve been testing with &#8220;alerts&#8221; in that code than never show up.</p>
</p>
<p>Any help would be greatly appreciated!!</p>
<p>Sloan</p></p>
]]></description>
        	        	<pubDate>Wed, 02 Sep 2009 14:13:36 +0300</pubDate>
        </item>
</channel>
</rss>