<?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: Dependent combobox</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/dependent-combobox</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/dependent-combobox/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>ppr on Dependent combobox</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27758</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27758</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>Ok, to handle the "next" et "previous" button in edit form:</p>
</p>
<p>Replace in the index.php</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2204' value='Select Code' data-codeid='sfcode2204' /></p>
<div class='sfcode' id='sfcode2204'>&#160; onSelectRow: function(rowid) {</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (rowid != null) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var record = $(&#34;#list3&#34;).getRowData(rowid);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var pgm=&#34;load_cities.php?<strong>country</strong>=&#34;+record.namect;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#34;#list3&#34;).setColProp(&#39;namecy&#39;,{editoptions:{dataUrl:pgm}});<br />&#160;&#160;&#160;&#160;&#160;&#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;&#160;&#160; }</p>
</div>
<p>by this:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit600' value='Select Code' data-codeid='sfcode600' /></p>
<div class='sfcode' id='sfcode600'>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; onSelectRow: function(rowid) {</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (rowid != null) {&#160;&#160;&#160;&#160;&#160;&#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;&#160;&#160;&#160;&#160;&#160;&#160; var record = $(&#34;#list3&#34;).getRowData(rowid);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var pgm=&#34;load_cities.php?country=&#34;+record.namect;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#34;#list3&#34;).setColProp(&#39;namecy&#39;,{editoptions:{dataUrl:pgm}});<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (gbFormEditOpen) { &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // management of Form Edit particularly to manage dropdown<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // get the dynamically selection dropdown&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#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;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.get(pgm, function(data) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // remove the &#60;select&#62;&#60;/selected&#62; tag from received data<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // to keep only the options<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data=data.replace(&#34;&#60;select&#62;&#34;,&#34;&#34;); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data=data.replace(&#34;&#60;/select&#62;&#34;,&#34;&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // clear the dropdown of FormEdit and fill it with new data<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#34;#namecy&#34;).empty().append(data);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // and put the selected item choose in jqGrid<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#34;#namecy&#34;).find(&#34;option:contains(&#39;&#34;+record.namecy+&#34;&#39;)&#34;).attr(&#34;selected&#34;,&#34;selected&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#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;&#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;&#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;&#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;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#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;</p>
</p>
</div>
<p>and replace this code</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9993' value='Select Code' data-codeid='sfcode9993' /></p>
<div class='sfcode' id='sfcode9993'>$(&#34;#list3&#8243;).jqGrid(&#39;navGrid&#39;,&#39;#pager3&#39;,{edit:true,add:true,del:true,search:true},<br />&#160;&#160; { viewPagerButtons:false,<br />&#160;&#160;&#160; recreateForm:true<br />});</div>
<p>by this:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9466' value='Select Code' data-codeid='sfcode9466' /></p>
<div class='sfcode' id='sfcode9466'>
<p>$(&#34;#list3&#34;).jqGrid(&#39;navGrid&#39;,&#39;#pager3&#39;,{edit:true,add:true,del:true,search:true},<br />&#160;&#160;&#160; {<br />&#160;&#160;&#160; recreateForm:true,<br />&#160;&#160;&#160; afterShowForm : function (formid) {gbFormEditOpen=true;},<br />&#160;&#160;&#160; onClose: function(s) {gbFormEditOpen=false;}<br />&#160;&#160;&#160; });</p>
</p>
</div>
<p>and replace this:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4643' value='Select Code' data-codeid='sfcode4643' /></p>
<div class='sfcode' id='sfcode4643'>
<p>&#60;script type=&#34;text/javascript&#34;&#62;</p>
<p>$(document).ready(function(){</p>
</p>
</div>
<p>by this</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9785' value='Select Code' data-codeid='sfcode9785' /></p>
<div class='sfcode' id='sfcode9785'>&#60;script type=&#34;text/javascript&#34;&#62;</p>
<p>var gbFormEditOpen=false; // global variable to know the state of FormEdit: true=open, false=close</p>
<p>$(document).ready(function(){</p>
</div>
<p>That&#39;s all !</p>
</p>
<p>Regards</p>
<p>Philippe</p>
]]></description>
        	        	<pubDate>Tue, 20 Nov 2012 00:16:13 +0200</pubDate>
        </item>
        <item>
        	<title>sebastiancb on Dependent combobox</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27747</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27747</guid>
        	        	<description><![CDATA[<p>Hello, it worked, but I had to modify the load_cities.php-&#62;</p>
</p>
<p>&#60;?php<br />$bd = mysql_connect("localhost","root","") or die("Connection Error: " . mysql_error());<br />mysql_select_db("depselect") or die("Error conecting to db.");</p>
<p><span style="color: #ff0000;"><strong>if(isset($_GET[&#39;id_country&#39;])){</strong></span><br />&#160;&#160; &#160;$id_country=$_GET[&#39;id_country&#39;];<br />&#160;&#160;&#160; $sql="select id,namecy from cities where idc=$id_country";&#160;&#160; &#160;<br />}<br />else {<br />&#160;&#160;&#160; $country= $_GET[&#39;country&#39;];<br />&#160;&#160;&#160; $sql="select cities.id,cities.namecy from countries inner join cities on countries.id=cities.idc where countries.namect=&#39;$country&#39;";&#160;&#160; &#160;<br />}&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160; &#160;<br />$rs = mysql_query($sql);<br />echo "&#60;select&#62;"; &#160;<br />while ($reg=mysql_fetch_array($rs)) {<br />echo "&#60;option value=&#39;".$reg[&#39;id&#39;]."&#39;&#62;".$reg[&#39;namecy&#39;]."&#60;/option&#62;";</p>
<p>}<br />echo"&#60;/select&#62;";<br />mysql_close($bd);<br />?&#62;</p>
</p>
<p>Now, you had told me that there is a way to enable the buttons "next" and "prev", I would like that you helped me with that</p>
]]></description>
        	        	<pubDate>Sat, 17 Nov 2012 23:44:21 +0200</pubDate>
        </item>
        <item>
        	<title>ppr on Dependent combobox</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27729</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27729</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>you must leave this line in the source code. Otherwise it will not work.</p>
<p>Your complete source with modifications in your message is correct.</p>
</p>
<p>Note, as this version is quick and dirty to show one of the ways of managing a depend combobox mechanism. It does not handle record saving.</p>
<p>If you want to use "save record" button, your <strong>edit.php</strong> has to manage the conversion from "country name" string and "city name" string into "country" id and "city" id.</p>
</p>
<p>Regards</p>
]]></description>
        	        	<pubDate>Tue, 13 Nov 2012 16:38:33 +0200</pubDate>
        </item>
        <item>
        	<title>sebastiancb on Dependent combobox</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27658</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27658</guid>
        	        	<description><![CDATA[<p>Hello, excuse me for bothering you, I replaced the code where you indicated me, but I don&#39;t know what to do with this line</p>
<p>&#160;<strong>{name:&#39;namecy&#39;,index:&#39;namecy&#39;,editable: true,edittype:"select",editoptions:{dataUrl:&#39;load_cities.php?id_country=1&#39;}}</strong></p>
<p>if I deleted it when I want to add a register the dropdown doesn&#39;t work.</p>
<p>here is the complete source with the modifications:</p>
<p>$("#list3").jqGrid({ url:&#39;list.php&#39;,<br />datatype: "xml",<br />colNames:[&#39;Id&#39;,&#39;name&#39;,&#39;country&#39;,&#39;city&#39;],<br />colModel:[{name:&#39;idp&#39;,index:&#39;idp&#39;, width:100,sortable:true,editable:true},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;name&#39;,index:&#39;name&#39;, width:100,sortable:false,editable:true,sortable:true},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;namect&#39;,index:&#39;namect&#39;, width:150,sortable:false,editable:true,sortable:true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; edittype:&#39;select&#39;,editoptions: {value:load_countries(),<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dataEvents:[{type: &#39;change&#39;, fn: function(e) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var thisval = $(e.target).val();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.get(&#39;load_cities.php?id_country=&#39;+thisval,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; function(data)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { $("select#namecy").html(data);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }); // end get<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }//end func<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } // end type<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ] // dataevents<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } // edit option<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#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; {name:&#39;namecy&#39;,index:&#39;namecy&#39;,editable: true,edittype:"select",editoptions:{dataUrl:&#39;load_cities.php?id_country=1&#39;}}],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; recreateForm:true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowNum:10,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowList:[10,20,30],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; pager: &#39;#pager3&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortname: &#39;idp&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortorder: "asc",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; xmlReader: {root: "rows",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; repeatitems : true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; id: "[id]"&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#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;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; caption: "Students",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; height:&#39;100%&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; editurl:"edit.php",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; onSelectRow: function(rowid) {</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (rowid != null) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var record = $("#list3").getRowData(rowid);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var pgm="load_cities.php?country="+record.namect;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $("#list3").setColProp(&#39;namecy&#39;,{editoptions:{dataUrl:pgm}});<br />&#160;&#160;&#160;&#160;&#160;&#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;&#160;&#160; }<br />});</p>
<p>//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />$("#list3").jqGrid(&#39;navGrid&#39;,&#39;#pager3&#39;,{edit:true,add:true,del:true,search:true},<br />&#160;&#160; { viewPagerButtons:false,<br />&#160;&#160;&#160; recreateForm:true<br />});</p>
]]></description>
        	        	<pubDate>Sat, 03 Nov 2012 22:24:30 +0200</pubDate>
        </item>
        <item>
        	<title>ppr on Dependent combobox</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27583</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27583</guid>
        	        	<description><![CDATA[<p>Hi sebastian,</p>
<p>This line :</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8367' value='Select Code' data-codeid='sfcode8367' /></p>
<div class='sfcode' id='sfcode8367'>{name:&#39;namecy&#39;,index:&#39;namecy&#39;,editable: true,edittype:&#34;select&#34;,editoptions:{dataUrl:&#39;load_cities.php?id_country=1&#39;}}</div>
<p>doesn&#39;t work because it needs to be changed dynamically on each record.</p>
<p>To make your project running, here is a quick solution:</p>
<p>In <strong>index.php</strong>, replace this code </p>
<p><input type='button' class='sfcodeselect' name='sfselectit8133' value='Select Code' data-codeid='sfcode8133' /></p>
<div class='sfcode' id='sfcode8133'>editurl:&#34;edit.php&#34;</div>
<p>by</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5931' value='Select Code' data-codeid='sfcode5931' /></p>
<div class='sfcode' id='sfcode5931'>&#160;&#160;&#160;&#160;&#160;&#160;&#160; editurl:&#34;edit.php&#34;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; onSelectRow: function(rowid) {</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (rowid != null) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var record = $(&#34;#list3&#34;).getRowData(rowid);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var pgm=&#34;load_cities.php?<strong>country</strong>=&#34;+record.namect;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#34;#list3&#34;).setColProp(&#39;namecy&#39;,{editoptions:{dataUrl:pgm}});<br />&#160;&#160;&#160;&#160;&#160;&#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;&#160;&#160; }</p>
</div>
<p>&#160;&#160; On each record, it will change dynamically the call of "load_cities.php" with the value of "namect". Be careful, it&#39;not the id_country value because it&#39;s not existing in the jqgrid...it&#39;s a name country value. We change the<strong> load_cities.php</strong> to manage this case below.</p>
<p>next: change this code in index.php</p>
<p><input type='button' class='sfcodeselect' name='sfselectit743' value='Select Code' data-codeid='sfcode743' /></p>
<div class='sfcode' id='sfcode743'>$(&#34;#list3?).jqGrid(&#39;navGrid&#39;,&#39;#pager3&#39;,{edit:true,add:true,del:true,search:true});</div>
<p>by this:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7844' value='Select Code' data-codeid='sfcode7844' /></p>
<div class='sfcode' id='sfcode7844'>
<p>$(&#34;#list3&#34;).jqGrid(&#39;navGrid&#39;,&#39;#pager3&#39;,{edit:true,add:true,del:true,search:true},&#160;&#160;&#160;</p>
<p>&#160;&#160; { viewPagerButtons:false,<br />&#160;&#160;&#160; recreateForm:true<br />&#160;&#160;&#160; });</p>
</div>
<p>RecreateForm=true : it&#39;s necessary to refresh dropdown cities when the form edit appears</p>
<p>viewPagerButtons=false : disable the next and prev buttons because the Form Edit requires a special management for next/prev buttons to initialize dynamic dropdown cities and the source code would become a little more complicated. (we can see this management in a next step if wished).</p>
<p>Then replace your load_cities.php by this new one (to manage the name country parameter case):</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3446' value='Select Code' data-codeid='sfcode3446' /></p>
<div class='sfcode' id='sfcode3446'>
<p>&#60;?php</p>
<p>$bd = mysql_connect(&#34;localhost&#34;,&#34;root&#34;,&#34;&#34;) or die(&#34;Connection Error: &#34; . mysql_error());<br />mysql_select_db(&#34;columbia&#34;) or die(&#34;Error conecting to db.&#34;);<br />$id_country=$_GET[&#39;id_country&#39;];</p>
<p>if(isset($id_country)) <br />&#160;&#160;&#160; $sql=&#34;select id,namecy from cities where idc=$id_country&#34;;&#160;&#160; &#160;<br />else {<br />&#160;&#160;&#160; $country= $_GET[&#39;country&#39;]; <br />&#160;&#160;&#160; $sql=&#34;select cities.id,cities.namecy from countries inner join cities on countries.id=cities.idc where countries.namect=&#39;$country&#39;&#34;;&#160;&#160; &#160;<br />}&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160; &#160;<br />$rs = mysql_query($sql);<br />echo &#34;&#60;select&#62;&#34;; &#160;<br />while ($reg=mysql_fetch_array($rs)) {<br />echo &#34;&#60;option value=&#39;&#34;.$reg[&#39;id&#39;].&#34;&#39;&#62;&#34;.$reg[&#39;namecy&#39;].&#34;&#60;/option&#62;&#34;;</p>
<p>}<br />echo&#34;&#60;/select&#62;&#34;;<br />mysql_close($bd);</p>
<p>?&#62;</p>
</div>
<p>Regards,</p>
</p>
<p>Phil</p>
]]></description>
        	        	<pubDate>Sat, 20 Oct 2012 15:27:29 +0300</pubDate>
        </item>
        <item>
        	<title>sebastiancb on Dependent combobox</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27576</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27576</guid>
        	        	<description><![CDATA[<p>Hello, thank you for your help, but when I add a register this example works fine, the problem is when I need edit such register because the city associated with the register is not the right.</p>
</p>
<p>The problem is this line:</p>
<p>{name:&#39;namecy&#39;,index:&#39;namecy&#39;,editable: true,edittype:"select",editoptions:{dataUrl:&#39;load_cities.php?id_country=1&#39;}}</p>
]]></description>
        	        	<pubDate>Fri, 19 Oct 2012 18:16:11 +0300</pubDate>
        </item>
        <item>
        	<title>ppr on Dependent combobox</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27550</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27550</guid>
        	        	<description><![CDATA[<p>Hi,</p>
</p>
<p>In your index.php change this :</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6001' value='Select Code' data-codeid='sfcode6001' /></p>
<div class='sfcode' id='sfcode6001'>function(data)<br />&#160; { $(&#34;select#namecy&#34;).html(data);<br />}); // end get</div>
<p>by this</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8594' value='Select Code' data-codeid='sfcode8594' /></p>
<div class='sfcode' id='sfcode8594'>
<p>function(data)<br />&#160; { $(&#34;#namecy&#34;).html(data);<br />}); // end get</p>
</p>
</div>
<p>and it will be Ok</p>
</p>
<p>Best regards</p>
</p>
<p>Phil</p></p>
]]></description>
        	        	<pubDate>Tue, 16 Oct 2012 18:00:32 +0300</pubDate>
        </item>
        <item>
        	<title>sebastiancb on Dependent combobox</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27486</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/dependent-combobox#p27486</guid>
        	        	<description><![CDATA[<p>Hello , what I need is to load some cities depending of the country, until now when I want to add registers the second combobox does this, but the problem happens when I need to edit the registers then when the form to edit popups the city asociated to the country is not loading in the second combobox, please help to solve this problem and finish my project.</p>
</p>
<p>here is the source code</p>
</p>
<p>index.php</p>
<p>&#60;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&#62;<br />&#60;html xmlns="http://www.w3.org/1999/xhtml"&#62;<br />&#60;head&#62;<br />&#60;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&#62;<br />&#60;title&#62;Ejemplo&#60;/title&#62;<br />&#60;script type="text/javascript" src="jquery.js"&#62;&#60;/script&#62;<br />&#60;script type="text/javascript" src="jquery-ui.js"&#62;&#60;/script&#62;<br />&#60;script type="text/javascript" src="grid.locale-es.js"&#62;&#60;/script&#62;<br />&#60;script type="text/javascript" src="jquery.jqGrid.min.js"&#62;&#60;/script&#62;<br />&#60;link href="jquery-ui.css" rel="stylesheet" type="text/css" /&#62;<br />&#60;link href="ui.jqgrid.css" rel="stylesheet" type="text/css" /&#62;</p>
<p>&#60;script type="text/javascript"&#62;<br />$(document).ready(function(){ <br />//--------------------------------------<br />function load_countries(){<br />var countries;<br />&#160;&#160; &#160;$.ajax({<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; url: &#39;load_countries.php&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; type: &#39;get&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; async: false,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; success: function(data){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;countries=data;&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160; &#160;&#160;&#160; &#160;});<br />&#160;&#160; &#160;return countries;<br />}<br />//--------------------------------------<br />$("#list3").jqGrid({ url:&#39;list.php&#39;,<br />datatype: "xml", <br />colNames:[&#39;Id&#39;,&#39;name&#39;,&#39;country&#39;,&#39;city&#39;], <br />colModel:[{name:&#39;idp&#39;,index:&#39;idp&#39;, width:100,sortable:true,editable:true}, <br />&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;name&#39;,index:&#39;name&#39;, width:100,sortable:false,editable:true,sortable:true}, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160; {name:&#39;namect&#39;,index:&#39;namect&#39;, width:150,sortable:false,editable:true,sortable:true,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160; edittype:&#39;select&#39;,editoptions: {value:load_countries(),<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dataEvents:[{type: &#39;change&#39;, fn: function(e) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var thisval = $(e.target).val();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.get(&#39;load_cities.php?id_country=&#39;+thisval, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; function(data)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { $("select#namecy").html(data);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }); // end get<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }//end func<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; } // end type<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;] // dataevents<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } // edit option<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#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; {name:&#39;namecy&#39;,index:&#39;namecy&#39;,editable: true,edittype:"select",editoptions:{dataUrl:&#39;load_cities.php?id_country=1&#39;}}],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; recreateForm:true,<br />&#160;&#160; &#160;&#160;&#160; &#160;rowNum:10,<br />&#160;&#160; &#160;&#160;&#160; &#160;rowList:[10,20,30],<br />&#160;&#160; &#160;&#160;&#160; &#160;pager: &#39;#pager3&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;sortname: &#39;idp&#39;, <br />&#160;&#160; &#160;&#160;&#160; &#160;viewrecords: true, <br />&#160;&#160; &#160;&#160;&#160; &#160;sortorder: "asc",<br />&#160;&#160; &#160;&#160;&#160; &#160;xmlReader: {root: "rows",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; repeatitems : true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; id: "[id]"&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#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;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },<br />&#160;&#160; &#160;&#160;&#160; &#160;caption: "Students",<br />&#160;&#160; &#160;&#160;&#160; &#160;height:&#39;100%&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;editurl:"edit.php"<br />});</p>
<p>//--------------------------------------<br />$("#list3").jqGrid(&#39;navGrid&#39;,&#39;#pager3&#39;,{edit:true,add:true,del:true,search:true});<br />//**********************************************************************************<br />});<br />&#60;/script&#62;<br />&#60;/head&#62;<br />&#60;body&#62;<br />&#160;&#60;table id="list3"&#62;&#60;/table&#62;<br />&#160;&#60;div id="pager3"&#62;&#60;/div&#62; <br />&#60;/body&#62;<br />&#60;/html&#62;</p>
</p>
<p>list.php</p>
</p>
<p>&#60;?php<br />&#160;$page = $_GET[&#39;page&#39;]; // get the requested page<br />&#160;$limit = $_GET[&#39;rows&#39;]; // get how many rows we want to have into the grid <br />&#160;$sidx = $_GET[&#39;sidx&#39;]; // get index row - i.e. user click to sort <br />&#160;$sord = $_GET[&#39;sord&#39;]; // get the direction <br />&#160;if(!$sidx) $sidx =1; // connect to the database $cmd-&#62;Connect($servidor,$usuario,$clave,$db);<br />&#160;$bd = mysql_connect("localhost","root","") or die("Connection Error: " . mysql_error());<br />&#160; mysql_select_db("depselect") or die("Error conecting to db.");<br />&#160;&#160; $result = mysql_query("SELECT COUNT(*) AS count FROM people"); <br />&#160;&#160; $row = mysql_fetch_array($result); <br />&#160;&#160; $count = $row[&#39;count&#39;]; <br />&#160;&#160; if( $count &#62;0 ) { $total_pages = ceil($count/$limit); } <br />&#160;&#160; else { $total_pages = 0; } <br />&#160;&#160; if ($page &#62; $total_pages) <br />&#160;&#160; $page=$total_pages; <br />&#160;&#160; $start = $limit*$page - $limit;<br />&#160;&#160; $sql = "SELECT idp,name,namect,namecy from people,countries,cities where people.country=countries.id and people.city=cities.id order by $sidx $sord LIMIT $start , $limit"; <br />&#160;&#160; $result = mysql_query($sql) or die("Couldn t execute query.".mysql_error()); <br />&#160; &#160;<br />&#160;&#160; if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) <br />&#160;&#160; { header("Content-type: application/xhtml+xml;charset=utf-8"); } <br />&#160;&#160; else { header("Content-type: text/xml;charset=utf-8"); } <br />&#160;&#160; echo "&#60;?xml version=&#39;1.0&#39; encoding=&#39;utf-8&#39;?&#62;"; <br />&#160;&#160; echo "&#60;rows&#62;"; echo "&#60;page&#62;".$page."&#60;/page&#62;"; <br />&#160;&#160; echo "&#60;total&#62;".$total_pages."&#60;/total&#62;"; <br />&#160;&#160; echo "&#60;records&#62;".$count."&#60;/records&#62;"; // be sure to put text data in CDATA <br />&#160;&#160; while($row = mysql_fetch_array($result) )<br />&#160;&#160; { echo "&#60;row id=&#39;". $row[&#39;idp&#39;]."&#39;&#62;"; <br />&#160;&#160;&#160;&#160; echo "&#60;cell&#62;". $row[&#39;idp&#39;]."&#60;/cell&#62;"; <br />&#160;&#160;&#160;&#160; echo "&#60;cell&#62;". $row[&#39;name&#39;]."&#60;/cell&#62;"; <br />&#160;&#160;&#160;&#160; echo "&#60;cell&#62;". $row[&#39;namect&#39;]."&#60;/cell&#62;"; <br />&#160;&#160;&#160;&#160; echo "&#60;cell&#62;". $row[&#39;namecy&#39;]."&#60;/cell&#62;"; <br />&#160;&#160; &#160; echo "&#60;/row&#62;"; <br />&#160;&#160; &#160;} <br />&#160;&#160; echo "&#60;/rows&#62;";<br />&#160;&#160; mysql_close($bd); <br />?&#62;</p>
</p>
<p>load_countries.php</p>
<p>&#60;?php<br />$bd = mysql_connect("localhost","root","") or die("Connection Error: " . mysql_error());<br />mysql_select_db("depselect") or die("Error conecting to db.");<br />$sql="select id,namect from countries";<br />$rs = mysql_query($sql);<br />$countries="";<br />while ($reg=mysql_fetch_array($rs)) {<br />$countries=$countries.$reg[&#39;id&#39;].":".$reg[&#39;namect&#39;].";";<br />}</p>
<p>$countries=substr($countries,0,strlen($countries)-1);<br />echo utf8_encode($countries);<br />?&#62;</p>
<p>load_cities.php</p>
<p>&#60;?php<br />$bd = mysql_connect("localhost","root","") or die("Connection Error: " . mysql_error());<br />mysql_select_db("depselect") or die("Error conecting to db.");<br />$id_country=$_GET[&#39;id_country&#39;];<br />$sql="select id,namecy from cities where idc=$id_country";<br />$rs = mysql_query($sql);<br />while ($reg=mysql_fetch_array($rs)) {<br />echo "&#60;option value=".$reg[&#39;id&#39;]."&#62;".$reg[&#39;namecy&#39;]."&#60;/option&#62;";<br />}<br />mysql_close($bd);<br />?&#62;</p>
<p>database</p>
</p>
<p>CREATE TABLE `cities` (<br />&#160; `id` int(11) NOT NULL,<br />&#160; `idc` int(11) NOT NULL,<br />&#160; `namecy` varchar(50) NOT NULL,<br />&#160; PRIMARY KEY&#160; (`id`),<br />&#160; KEY `idc` (`idc`)<br />) ENGINE=InnoDB DEFAULT CHARSET=utf8;</p>
<p>--<br />-- Volcar la base de datos para la tabla `cities`<br />--</p>
<p>INSERT INTO `cities` (`id`, `idc`, `namecy`) VALUES<br />(0, 0, &#39;----&#39;),<br />(1, 1, &#39;Washington&#39;),<br />(2, 1, &#39;New York&#39;),<br />(3, 2, &#39;Berlin&#39;),<br />(4, 2, &#39;Hannover&#39;);</p>
<p>-- --------------------------------------------------------</p>
<p>--<br />-- Estructura de tabla para la tabla `countries`<br />--</p>
<p>CREATE TABLE `countries` (<br />&#160; `id` int(11) NOT NULL,<br />&#160; `namect` varchar(50) NOT NULL,<br />&#160; PRIMARY KEY&#160; (`id`)<br />) ENGINE=InnoDB DEFAULT CHARSET=utf8;</p>
<p>--<br />-- Volcar la base de datos para la tabla `countries`<br />--</p>
<p>INSERT INTO `countries` (`id`, `namect`) VALUES<br />(0, &#39;-----&#39;),<br />(1, &#39;USA&#39;),<br />(2, &#39;Germany&#39;);</p>
<p>-- --------------------------------------------------------</p>
<p>--<br />-- Estructura de tabla para la tabla `people`<br />--</p>
<p>CREATE TABLE `people` (<br />&#160; `idp` int(11) NOT NULL,<br />&#160; `name` varchar(50) NOT NULL,<br />&#160; `country` int(11) NOT NULL,<br />&#160; `city` int(11) NOT NULL,<br />&#160; PRIMARY KEY&#160; (`idp`)<br />) ENGINE=InnoDB DEFAULT CHARSET=utf8;</p>
<p>--<br />-- Volcar la base de datos para la tabla `people`<br />--</p>
<p>INSERT INTO `people` (`idp`, `name`, `country`, `city`) VALUES<br />(1, &#39;Johann&#39;, 2, 3),<br />(2, &#39;John&#39;, 1, 1);</p>
<p>--<br />-- Filtros para las tablas descargadas (dump)<br />--</p>
<p>--<br />-- Filtros para la tabla `cities`<br />--<br />ALTER TABLE `cities`<br />&#160; ADD CONSTRAINT `cities_ibfk_1` FOREIGN KEY (`idc`) REFERENCES `countries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;</p>
]]></description>
        	        	<pubDate>Fri, 05 Oct 2012 02:02:17 +0300</pubDate>
        </item>
</channel>
</rss>