<?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: Get data from selected row of Master to send with Detail</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/get-data-from-selected-row-of-master-to-send-with-detail</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/get-data-from-selected-row-of-master-to-send-with-detail/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>finedesignz on Get data from selected row of Master to send with Detail</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/get-data-from-selected-row-of-master-to-send-with-detail#p7020</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/get-data-from-selected-row-of-master-to-send-with-detail#p7020</guid>
        	        	<description><![CDATA[<p>I&#39;m not sure if my post is clear, but all I need is this:</p>
<p>When I add a row to the detail grid using the navGrid add button (formedit method), I want to send the rowid of selected row of the master grid to the server in the POST automatically.</p>
<p>Can anyone help me with this?&#160; <strong></strong></p>
<p><strong>Thanks in advance.</strong></p>
]]></description>
        	        	<pubDate>Tue, 02 Jun 2009 17:33:29 +0300</pubDate>
        </item>
        <item>
        	<title>finedesignz on Get data from selected row of Master to send with Detail</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/get-data-from-selected-row-of-master-to-send-with-detail#p7014</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/get-data-from-selected-row-of-master-to-send-with-detail#p7014</guid>
        	        	<description><![CDATA[<p>I actually only need the rowid selected&#8230; I&#39;ve read all the posts after searching for master, but none of them work.&#160; Here&#39;s my code:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1586' value='Select Code' data-codeid='sfcode1586' /></p>
<div class='sfcode' id='sfcode1586'>jQuery(document).ready(function(){<br />&#160; $(&#8221;#list&#8221;).jqGrid({<br />&#160;&#160;&#160; url:&#39;data/dashboard.php&#39;,<br />&#160;&#160;&#160; datatype: &#39;xml&#39;,<br />&#160;&#160;&#160; mtype: &#39;GET&#39;,<br />&#160;&#160;&#160; colModel :[<br />&#160;&#160;&#160;&#160;&#160; {name:&#39;fname&#39;, index:&#39;fname&#39;, label:&#39;First Name&#39;, width:130, editable:true,editoptions:{size:30}},<br />&#160;&#160;&#160;&#160;&#160; {name:&#39;lname&#39;, index:&#39;lname&#39;, label:&#39;Last Name&#39;, width:150, editable:true,editoptions:{size:30}},<br />&#160;&#160;&#160;&#160;&#160; {name:&#39;logon&#39;, index:&#39;logon&#39;, label:&#39;Last Logon&#39;, width:120, align:&#39;center&#39;,editable:false},<br />&#160;&#160;&#160;&#160;&#160; {name:&#39;start&#39;, index:&#39;start&#39;, label:&#39;Start Date&#39;, width:120, align:&#39;center&#39;,editable:true,editoptions:{size:20}},<br />&#160;&#160;&#160;&#160;&#160; {name:&#39;userid&#39;, index:&#39;userid&#39;, label:&#39;User ID&#39;, width:150,editable:true,editoptions:{size:40}},<br />&#160;&#160;&#160;&#160;&#160; {name:&#39;note&#39;, index:&#39;note&#39;, label:&#39;Notes&#39;, width:150, sortable:false,editable:true,edittype:"textarea", editoptions:{rows:"3",cols:"50"}}<br />&#160;&#160;&#160; ],<br />&#160;&#160;&#160; pager: $(&#39;#pager&#39;),<br />&#160;&#160;&#160; rowNum:60,<br />&#160;&#160;&#160; rowList:[20,40,60],<br />&#160;&#160;&#160; sortname: &#39;lname&#39;,<br />&#160;&#160;&#160; sortorder: &#8220;asc&#8221;,<br />&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160; imgpath: &#39;themes/steel/images&#39;,<br />&#160;&#160;&#160; caption: &#39;Customers&#39;,<br />&#160;&#160;&#160; height:300,<br />&#160;&#160;&#160; onSelectRow: function(ids) {</p>
<p>&#160;&#160;&#160; &#160;&#160;&#160; if(ids == null) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ids=0;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(jQuery(&#8221;#list_detail&#8221;).getGridParam(&#39;records&#39;) &#62; 0 ) {<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160; jQuery(&#8221;#list_detail&#8221;).setGridParam({url:&#8221;data/subgrid.php?&#38;q=1&#38;id=&#8221;+ids,page:1})<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160; .setCaption(&#8221;License Detail: &#8220;+ids)<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160; .trigger(&#39;reloadGrid&#39;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160; &#160;&#160;&#160; } else {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; jQuery(&#8221;#list_detail&#8221;).setGridParam({url:&#8221;data/subgrid.php?&#38;q=1&#38;id=&#8221;+ids,page:1})<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; .setCaption(&#8221;License Detail: &#8220;+ids)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; .trigger(&#39;reloadGrid&#39;);<br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; }<br />&#160; }).navGrid(&#39;#pager&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {add: true, edit: true, del: true, search: true}, //options<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {editCaption:&#39;Edit License&#39;, height:200,width:600,reloadAfterSubmit:false,url:&#39;useredit.php&#39;}, // edit options<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {editCaption:&#39;Add License&#39;, height:200,width:600,reloadAfterSubmit:false,url:&#39;useredit.php&#39;}, // add options<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {caption:&#39;Delete License&#39;, reloadAfterSubmit:false,url:&#39;useredit.php&#39;}, // del options<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {width:600} // search options<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; );<br />&#160;&#160;&#160; $(&#8221;#license&#8221;).click(function(){<br />&#160;&#160;&#160; &#160;&#160;&#160; var gr = jQuery(&#8221;#list&#8221;).getGridParam(&#39;selrow&#39;);<br />&#160;&#160;&#160; &#160;&#160;&#160; if( gr != null ) jQuery(&#8221;#list&#8221;).editGridRow(gr,{height:280,reloadAfterSubmit:false});<br />&#160;&#160;&#160; &#160;&#160;&#160; else alert(&#8221;Please Select a Customer if you would like to Add a New License&#8221;);<br />&#160;&#160;&#160; });</p>
<p>// Begin License Subgrid</p>
<p>&#160; $(&#8221;#list_detail&#8221;).jqGrid({<br />&#160;&#160;&#160; &#160; height: 100,<br />&#160;&#160;&#160; &#160; width:851,<br />&#160;&#160;&#160; &#160; url:&#39;data/subgrid.php?q=1&#38;id=0&#39;,<br />&#160;&#160;&#160; &#160; datatype: &#8220;xml&#8221;,<br />&#160;&#160;&#160;&#160;&#160; mtype: &#8220;GET&#8221;,<br />&#160;&#160;&#160; &#160; colModel:[<br />&#160;&#160;&#160;&#160;&#160; {name:&#39;user_id&#39;,index:&#39;user_id&#39;, label:&#39;User&#39;, align:&#39;center&#39;, hidden:true, edittype:"text", editrules:{number:true}, width:180, editable:true, editoptions:{value:""+user_id, size:30}},<br />&#160;&#160;&#160;&#160;&#160; {name:&#39;app&#39;,index:&#39;app&#39;, label:&#39;Application&#39;, width:200, align:&#39;center&#39;, editable:true, edittype:"select",<br />&#160;&#160;&#160;&#160;&#160; editoptions:{value:"&#60;?php include &#39;includes/dbconfig.inc.php&#39;;<br />$con = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error());<br />mysql_select_db($database) or die("Error connecting to db.");<br />$query&#160; = "SELECT id,app FROM appid";<br />$result = mysql_query($query);<br />while($row = mysql_fetch_array($result))<br />{<br />&#160; echo $row[&#39;id&#39;] . &#8220;:&#8221; . $row[&#39;app&#39;] . &#8220;;&#8221;;<br />}<br />mysql_close($con); ?&#62;&#8221;}},<br />&#160;&#160;&#160;&#160;&#160; {name:&#39;expiration&#39;,index:&#39;expiration&#39;, label:&#39;Expires&#39;, align:&#39;center&#39;, editrules:{date:true}, datefmt:&#39;yyyy-mm-dd&#39;, width:180, editable:true,editoptions:{size:30}}<br />&#160;&#160;&#160; &#160; ],<br />&#160;&#160;&#160; &#160; rowNum:5,<br />&#160;&#160;&#160; &#160; rowList:[5,10,20],<br />&#160;&#160;&#160; &#160;&#160;&#160; imgpath: &#39;themes/steel/images&#39;,<br />&#160;&#160;&#160; &#160; pager: jQuery(&#39;#pager_detail&#39;),<br />&#160;&#160;&#160; &#160; sortname: &#39;app&#39;,<br />&#160;&#160;&#160; &#160; viewrecords: true,<br />&#160;&#160;&#160; &#160; sortorder: &#8220;asc&#8221;,<br />&#160;&#160;&#160; &#160; caption:&#8221;License Detail&#8221;<br />&#160; }).navGrid(&#39;#pager_detail&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {add:true,edit:true,del:true,search:false}, //options<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {height:200,width:600,reloadAfterSubmit:true,url:&#39;licenseedit.php&#39;}, // edit options<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {height:200,width:600,reloadAfterSubmit:false,url:&#39;licenseedit.php&#39;}, // add options<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {reloadAfterSubmit:false,url:&#39;licenseedit.php&#39;}, // del options<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {width:600} // search options<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; );<br />});</p>
</div>
<p>I&#39;ve tried this option from another post, but I&#39;m using only navGrid for editing (no inline editing):</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9252' value='Select Code' data-codeid='sfcode9252' /></p>
<div class='sfcode' id='sfcode9252'>
<p>jQuery(&#8221;#detail&#8221;).jqGrid({&#8230;}).navGrid(&#8221;#pgdetail&#8221;,{&#8230;},</p>
<p>{&#8230;}, //edit</p>
<p>{&#8230;</p>
<p>beforeShowForm: function(formid) {</p>
<p>// we should get the id of the master here</p>
<p>mid = jQuery(&#8221;#master&#8221;).getGridParam(&#8221;selrow&#8221;);</p>
<p>if (mid != null ) {</p>
<p>// now we can set it in editurl</p>
<p>jQuery(&#8221;#detail&#8221;).setGridParam({editurl:&#8221;myurlhere.php?masterid=&#8221;+mid});</p>
<p>}</p>
<p>}</p>
<p>&#8230;.</p>
</div>
<p>How do I set the "add" url only?</p>
]]></description>
        	        	<pubDate>Tue, 02 Jun 2009 08:37:04 +0300</pubDate>
        </item>
        <item>
        	<title>finedesignz on Get data from selected row of Master to send with Detail</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/get-data-from-selected-row-of-master-to-send-with-detail#p7008</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/get-data-from-selected-row-of-master-to-send-with-detail#p7008</guid>
        	        	<description><![CDATA[<p>I have a Master/Detail grid setup, each pulls data from a different table with a common key. The master grid contains a unique &#8220;user_id&#8221; value for each row.</p>
<p><strong>How do I pass this &#8220;user_id&#8221; value from the selected row of the master grid AUTOMATICALLY when I&#39;m adding a record to the detail grid?<br /></strong></p>
<p>I don&#39;t want to have to add the same &#8220;user_id&#8221; each time a record is added to the detail grid&#8230; it should be automatically entered according to the row they&#39;ve selected in the Master Grid.</p>
]]></description>
        	        	<pubDate>Mon, 01 Jun 2009 15:38:05 +0300</pubDate>
        </item>
</channel>
</rss>