<?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 Add data ok Problems with Edit and delete.</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/master-detail-add-data-ok-problems-with-edit-and-delete</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/master-detail-add-data-ok-problems-with-edit-and-delete/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>leerickx on Master Detail Add data ok Problems with Edit and delete.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/master-detail-add-data-ok-problems-with-edit-and-delete#p28423</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/master-detail-add-data-ok-problems-with-edit-and-delete#p28423</guid>
        	        	<description><![CDATA[<p><img class="spSmiley" style="margin:0" title="Cool" src="/blog/wp-content/forum-smileys/sf-cool.gif" alt="Cool" /></p>
<div>Sorry I had some trouble with my db...</div>
<div>I delete the relation between my two tables and success.</div>
<div></div>
<div></div>
]]></description>
        	        	<pubDate>Mon, 11 Mar 2013 16:45:05 +0200</pubDate>
        </item>
        <item>
        	<title>leerickx on Master Detail Add data ok Problems with Edit and delete.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/master-detail-add-data-ok-problems-with-edit-and-delete#p28414</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/master-detail-add-data-ok-problems-with-edit-and-delete#p28414</guid>
        	        	<description><![CDATA[<p>well,</p>
<p>I tried to put in the parameter of Edit :</p>
<p>beforeShowForm: function(fordid) {</p>
<p>var mygriddetail = $(&#39;#list10_d&#39;);</p>
<p>var did = mygrid.jqGrid(&#39;getGridParam&#39;,&#39;selrow&#39;);</p>
<p>var celdid = mygrid.jqGrid(&#39;getCell&#39;, did, &#39;id&#39;);</p>
<p>if (did != null) {</p>
<p>jQuery("#list10_d").setGridParam({editurl:&#39;addupdatedeldataFileUpload.php?q=2&#38;id=&#39;+celdid});</p>
<p>}</p>
<p>else alert("Vous n&#39;avez s&#233;lectionnez aucune fiche")</p>
<p>}</p>
<p>..... nothing to do, the update doesn&#39;t work.....</p>
]]></description>
        	        	<pubDate>Fri, 08 Mar 2013 15:48:28 +0200</pubDate>
        </item>
        <item>
        	<title>leerickx on Master Detail Add data ok Problems with Edit and delete.</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/master-detail-add-data-ok-problems-with-edit-and-delete#p28409</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/master-detail-add-data-ok-problems-with-edit-and-delete#p28409</guid>
        	        	<description><![CDATA[<p>Hello everybody and first of all,</p>
<p>I would like to thank all the people like Tony or Oleg with their various codes below that really help me.</p>
</p>
<p>I&#39;ve a Grid (table &#39;fiche&#39;) with sub Grid (data from &#39;fiche) and Grid Detail who display correctly my data from another table &#39;fileupload&#39; (FK index)</p>
</p>
<p>ficheprojet.jqGrid({	 &#160; &#160;</p>
<p><strong>//=============&#160; &#160;&#160; </strong></p>
<p><strong>// Grid Setup </strong></p>
<p><span style="white-space:pre"> </span>url:&#39;jqgrid.php?q=2&#39;,</p>
<p><span style="white-space:pre"> </span>datatype: &#39;xml&#39;,</p>
<p><span style="white-space:pre"> </span>mtype: &#39;GET&#39;,</p>
<p><span style="white-space:pre"> </span>pager: &#39;#gridpager&#39;,</p>
<p><span style="white-space:pre"> </span>editurl: "addupdatedeldata.php",</p>
<p><strong>//=============&#160; &#160;&#160;</strong></p>
<p><strong>// subGrid Setup</strong></p>
<p><span style="white-space:pre"> </span>subGrid : true,</p>
<p><span style="white-space:pre"> </span>subGridUrl: &#39;subgrid.php?q=2&#39;,&#160; &#160;</p>
<p><span style="white-space:pre"> </span>subGridModel: [{ name &#160;: [&#39;nomactivite&#39;], width : [400] },<span style="white-space:pre"> </span></p>
<p><strong>//=============&#160; &#160;&#160;</strong></p>
<p><strong>// onSelectRow Master Detail</strong></p>
<p>onSelectRow: function(ids) {</p>
<p><span style="white-space:pre"> </span>if(ids == null) {</p>
<p><span style="white-space:pre"> </span>ids=0;</p>
<p><span style="white-space:pre"> </span>if(jQuery("#list10_d").jqGrid(&#39;getGridParam&#39;,&#39;records&#39;) &#62;0 )</p>
<p><span style="white-space:pre"> </span>{</p>
<p><span style="white-space:pre"> </span>jQuery("#list10_d").jqGrid(&#39;setGridParam&#39;,{url:"subgridupload.php?q=2&#38;id="+ids,page:1});	<span style="white-space:pre"> </span>jQuery("#list10_d").jqGrid(&#39;setCaption&#39;,"Fiche Projet ID: "+ids)				.trigger(&#39;reloadGrid&#39;);</p>
<p><span style="white-space:pre"> </span>}</p>
<p><span style="white-space:pre"> </span>} else {</p>
<p><span style="white-space:pre"> </span>jQuery("#list10_d").jqGrid(&#39;setGridParam&#39;,{url:"subgridupload.php?q=2&#38;id="+ids,page:1});	<span style="white-space:pre"> </span>jQuery("#list10_d").jqGrid(&#39;setCaption&#39;,"Fiche Projet ID: "+ids)			.trigger(&#39;reloadGrid&#39;);</p>
<p><span style="white-space:pre"> </span>}</p>
<p>},</p>
<p><strong>//=============&#160; &#160;&#160;</strong></p>
<p><strong>// Column Definition</strong></p>
<p>colNames:[&#39;id&#39;, &#39;secteur&#39;, &#39;projet&#39;, &#39;datec&#39;, &#39;datef&#39;,&#39;educperm&#39;, &#39;nomactivite&#39;, &#39;actionreguliere&#39;, &#39;animateur&#39;, &#39;collaboration&#39;, &#39;lieu&#39;, &#39;nbreparticipant&#39;,&#39;dureeanim&#39;, &#39;objgen&#39;, &#39;objop&#39;, &#39;prerequis&#39;],</p>
<p>colModel :[	 &#160;</p>
<p>{name:&#39;id&#39;, index:&#39;id&#39;, fixed:true, width:30},</p>
<p>{name:&#39;idsecteur&#39;, index:&#39;secteur&#39;, width:30, search:true, editable:true, edittype:"select"},</p>
<p>{},</p>
<p>{name:&#39;prerequis&#39;, index:&#39;prerequis&#39;, width:300, editable:true,hidden:true, editrules: {edithidden: true}, edittype:"textarea",}		&#160; &#160;</p>
<p>],</p>
<p>});</p>
</p>
<p>$("#ficheprojet").jqGrid(&#39;navGrid&#39;,&#39;#gridpager&#39;,{edit:true,add:true,del:true,search:true},&#160;</p>
<p>{//prmEdit</p>
<p>closeAfterEdit:true,</p>
<p>viewPagerButtons:false,</p>
<p>recreateForm:true,</p>
<p>},</p>
<p>{//prmAdd</p>
<p>closeAfterAdd:true}</p>
<p>);</p>
</p>
<p><strong>// DETAIL Setup I test how to add/edit/del into another table before going further)</strong></p>
<p>jQuery("#list10_d").jqGrid({</p>
<p>height: 200,</p>
<p>width: 700,</p>
<p>url:&#39;subgridupload.php?q=2&#38;id=0&#39;,</p>
<p>//editurl: "addupdatedeldataFileUpload.php",</p>
<p>datatype: "xml",</p>
<p>mtype: &#39;GET&#39;,</p>
<p>colNames:[&#39;idfileupload&#39;,&#39;namefileupload&#39;,&#39;id&#39;], <strong>//&#39;id&#39; come from Master from my table &#39;ficheprojet&#39; now I try just to understand and this not really an uploadfile, I insert a name to test the insert in my table &#39;fileupload&#39; and display in the detail.</strong></p>
<p>colModel:[</p>
<p>{name:&#39;idfileupload&#39;, index:&#39;idfileupload&#39;, fixed:true, width:30},</p>
<p>{name:&#39;namefileupload&#39;, index:&#39;namefileupload&#39;, width:55, editable:true },</p>
<p>{name:&#39;id&#39;, index:&#39;id&#39;, fixed:true, width:30 },</p>
<p>],</p>
<p>rowNum:20,</p>
<p>rowList:[5,10,20],</p>
<p>rownumbers: true,</p>
<p>viewrecords: true,</p>
<p>pager: &#39;#pager10_d&#39;,</p>
<p>multiselect: false,</p>
<p>caption:"Upload"</p>
<p>}).navGrid(&#39;#pager10_d&#39;,{add:true,edit:true,del:true}, //options</p>
</p>
<p>{//prmEdit</p>
<p>reloadAfterSubmit:false,</p>
<p>closeAfterEdit:true,</p>
<p>viewPagerButtons:false,</p>
<p>recreateForm:true,</p>
<p>},</p>
</p>
<p>{//prmAdd</p>
<p>closeAfterAdd:true,</p>
<p>beforeShowForm: function(formid) {</p>
<p>// we should get the id of the master here</p>
<p>var mid = jQuery("#ficheprojet").getGridParam(&#39;selrow&#39;);</p>
<p>if (mid != null ) {</p>
<p>// now we can set it in editurl</p>
<p>jQuery("#list10_d").setGridParam({editurl:&#39;addupdatedeldataFileUpload.php?q=2&#38;id=0&#39;+mid}); <strong>//everything works fine</strong></p>
<p>}</p>
<p>else alert("Vous n&#39;avez s&#233;lectionn&#233; aucune fiche")</p>
<p>}</p>
<p>},</p>
</p>
<p>{//prmDel</p>
<p>closeAfterDel:true,</p>
<p>reloadAfterSubmit:false,</p>
<p>}</p>
</p>
<p>);</p>
<p>});</p>
</p>
<p>I post my&#160;<strong>addupdatedeldataFileUpload.php</strong></p>
<p>&#60;?php</p>
<p>include_once(&#39;dbconfig.php&#39;);</p>
<p>$idfileupload = $_POST[&#39;idfileupload&#39;];</p>
<p>$namefileupload = $_POST[&#39;namefileupload&#39;];</p>
<p>$id = $_GET[&#39;id&#39;];</p>
<p>if ($_POST[&#39;oper&#39;] == &#39;add&#39;) {</p>
<p>$q = mysql_query("insert into fileupload (namefileupload, id) VALUES(&#39;$_POST[namefileupload]&#39;,&#39;$_GET[id]&#39;)") or die(mysql_error());</p>
<p>}</p>
<p>if ($_POST[&#39;oper&#39;] == &#39;edit&#39;) {</p>
<p>$q = mysql_query("update fileupload set namefileupload=&#39;$namefileupload&#39;, id=&#39;$id&#39; where idfileupload=&#39;$idfileupload&#39;")or die(mysql_error());</p>
<p>}</p>
<p>if ($_POST[&#39;oper&#39;] == &#39;del&#39;) {</p>
<p>$q = mysql_query("delete from fileupload where idfileupload=&#39;$idfileupload&#39;")or die(mysql_error());</p>
<p>}</p>
<p>?&#62;</p>
</p>
<p>I do not understand why insert data works fine in a row and into the table fileupload ,&#160;the data is displayed too correctly, but I can neither deleter nor updater data from my table &#39;fileupload&#39;.</p>
<p>When I delete a row in Detail Grid i see the row deleted but not in my table and if i reload the detail grid my row is always there.</p>
<p>When I updated the row I&#39;ve the same problem but one more with the master id who change in my row. There is not the same.</p>
<p>A very big thank you for helping me.</p></p>
]]></description>
        	        	<pubDate>Thu, 07 Mar 2013 12:06:20 +0200</pubDate>
        </item>
</channel>
</rss>