<?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: Cannot make jqGridEdit work after sucess with jqGridRender</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/cannot-make-jqgridedit-work-after-sucess-with-jqgridrender</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/cannot-make-jqgridedit-work-after-sucess-with-jqgridrender/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Cannot make jqGridEdit work after sucess with jqGridRender</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cannot-make-jqgridedit-work-after-sucess-with-jqgridrender#p27396</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cannot-make-jqgridedit-work-after-sucess-with-jqgridrender#p27396</guid>
        	        	<description><![CDATA[<p>Hello,</p>
</p>
<p>Please write your question in the approriate <a href="http://www.triarnd.net/forum" target="_blank">forum here</a></p>
</p>
<p>Thank you</p>
<p>Regards</p>
]]></description>
        	        	<pubDate>Thu, 27 Sep 2012 12:52:59 +0300</pubDate>
        </item>
        <item>
        	<title>bailamj on Cannot make jqGridEdit work after sucess with jqGridRender</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cannot-make-jqgridedit-work-after-sucess-with-jqgridrender#p27394</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cannot-make-jqgridedit-work-after-sucess-with-jqgridrender#p27394</guid>
        	        	<description><![CDATA[<p>I need help too for this 😉</p></p>
]]></description>
        	        	<pubDate>Thu, 27 Sep 2012 11:55:48 +0300</pubDate>
        </item>
        <item>
        	<title>stevie on Cannot make jqGridEdit work after sucess with jqGridRender</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cannot-make-jqgridedit-work-after-sucess-with-jqgridrender#p21965</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cannot-make-jqgridedit-work-after-sucess-with-jqgridrender#p21965</guid>
        	        	<description><![CDATA[</p>
<p>Ok I am total new to this and I wanted to build an app which allowed simple administration of some SQL tables. So  basically normal stuff like select, insert, update and delete.</p>
<p>I  know a little php and html and ok with SQL but know very little about  java scripts. Part of the attraction of using jQuery and jEdit&#8230;</p>
</p>
<p>So I started with the some simple code that allows me to add records to the Northwind db. It works perfectly. Below is the code:</p>
</p>
<p>Main html:</p>
<p>&#60;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&#62;<br /> &#60;html&#62;<br /> &#160; &#60;head&#62;<br /> &#160;&#160;&#160; &#60;title&#62;jqGrid PHP Demo&#60;/title&#62;</p>
<p> &#160;&#160;&#160; &#60;link rel=&#39;stylesheet&#39; type="text/css" media="screen" href="themes/redmond/jquery-ui-1.8.2.custom.css" /&#62;<br /> &#160;&#160;&#160; &#60;link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" /&#62;<br /> &#160;&#160;&#160; &#60;link rel="stylesheet" type="text/css" media="screen" href="themes/ui.multiselect.css" /&#62;<br /> &#160;&#160;&#160; &#60;style type="text"&#62;<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160; html, body {<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160; margin: 0;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;/* Remove body margin/padding */<br /> &#160;&#160; &#160;&#160;&#160; &#160;padding: 0;<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160; overflow: hidden;&#160;&#160; &#160;/* Remove scroll bars on browser window */<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160; font-size: 75%;<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br /> &#160;&#160;&#160; &#60;/style&#62;<br /> &#160; &#160;&#160; &#60;script src="js/jquery.js" type="text/javascript"&#62;&#60;/script&#62;<br /> &#160;&#160;&#160; &#60;script src="js/i18n/grid.locale-en.js" type="text/javascript"&#62;&#60;/script&#62;<br /> &#160;&#160; &#160;&#60;script type="text/javascript"&#62;<br /> &#160;&#160; &#160;&#160;&#160; &#160;$.jgrid.no_legacy_api = true;<br /> &#160;&#160; &#160;&#160;&#160; &#160;$.jgrid.useJSON = true;<br /> &#160;&#160; &#160;&#60;/script&#62;<br /> &#160;&#160;&#160; &#60;script src="js/jquery.jqGrid.min.js" type="text/javascript"&#62;&#60;/script&#62;<br /> &#160;&#160;&#160; &#60;script src="js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"&#62;&#60;/script&#62;<br /> &#160; &#60;/head&#62;<br /> &#160; &#60;body&#62;<br /> &#160;&#160;&#160;&#160;&#160; &#60;div&#62;<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;?php include("gridData.php");?&#62;<br /> &#160;&#160;&#160;&#160;&#160; &#60;/div&#62;<br /> &#160;&#160; &#60;/body&#62;<br /> &#60;/html&#62;</p>
<p>And gridData.php is</p>
<p>&#60;?php<br /> define(&#39;DB_DSN&#39;,&#39;mysql:host=localhost;dbname=northwind&#39;);<br /> define(&#39;DB_USER&#39;, &#39;root&#39;);&#160;&#160;&#160;&#160; // Your MySQL username<br /> define(&#39;DB_PASSWORD&#39;, &#39;root&#39;); // &#8230;and password<br /> // include the jqGrid Class<br /> //echo UTILPATH;<br /> require_once "php/jqGrid.php";<br /> // include the driver class<br /> require_once "php/jqGridPdo.php";<br /> // Connection to the server<br /> $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);<br /> // Tell the db that we use utf-8<br /> $conn-&#62;query("SET NAMES utf8&#8243;);<br /> // Create the jqGrid instance<br /> $grid = new jqGridRender($conn);<br /> // Set output format to json<br /> $grid-&#62;dataType = &#39;json&#39;;</p>
<p> // Write the SQL Query<br /> $grid-&#62;SelectCommand = &#39;SELECT OrderID, OrderDate, CustomerID, Freight, ShipName FROM orders&#39;;<br /> // Set the table to where we add the data<br /> $grid-&#62;table = &#39;orders&#39;;<br /> // We tell that the primary key is not serial, which should be inserted by the user<br /> $grid-&#62;serialKey = false;</p>
<p> // Let the grid create the model<br /> $grid-&#62;setColModel();</p>
<p> // Set the url from where we obtain the data<br /> $grid-&#62;setUrl(&#39;gridData.php&#39;);</p>
<p> // Set some grid options<br /> $grid-&#62;setGridOptions(array(<br /> &#160;&#160;&#160; "rowNum"=&#62;10,<br /> &#160;&#160;&#160; "rowList"=&#62;array(10,20,30),<br /> &#160;&#160;&#160; "sortname"=&#62;"orderID"<br /> ));</p>
<p> // Enable navigator<br /> $grid-&#62;navigator = true;<br /> // Enable only adding<br /> $grid-&#62;setNavOptions(&#39;navigator&#39;,  array("excel"=&#62;false,"add"=&#62;true,"edit"=&#62;false,"del"=&#62;false,"view"=&#62;false,  "search"=&#62;false));<br /> // Close the dialog after the record is added<br /> $grid-&#62;setNavOptions(&#39;add&#39;,array("closeAfterAdd"=&#62;true,"reloadAfterSubmit"=&#62;true));<br /> // Enjoy<br /> $grid-&#62;renderGrid(&#39;#grid&#39;,&#39;#pager&#39;,true, null, null, true,true);<br /> $conn = null;</p>
<p> ?&#62;</p>
<p>The output is as expected (sorry the grid graphics will not copy):</p>
<p>[Image Can Not Be Found][Image Can Not Be Found]</p>
<p>&#160;<br /> OrderID OrderDate&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CustomerID&#160;&#160; &#160;&#160;&#160;&#160;&#160; Freight&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160; ShipName<br /> 10248&#160;&#160; &#160;1996-07-04 00:00:00&#160;&#160; &#160;WILMK&#160;&#160; &#160;32.3800&#160;&#160; &#160;Vins et alcools Chevalier<br /> 10249&#160;&#160; &#160;1996-07-05 00:00:00&#160;&#160; &#160;TRADH&#160;&#160; &#160;11.6100&#160;&#160; &#160;Toms Spezialit&#8240;ten<br /> 10250&#160;&#160; &#160;1996-07-08 00:00:00&#160;&#160; &#160;HANAR&#160;&#160; &#160;65.8300&#160;&#160; &#160;Hanari Carnes<br /> 10251&#160;&#160; &#160;1996-07-08 00:00:00&#160;&#160; &#160;VICTE&#160;&#160; &#160;41.3400&#160;&#160; &#160;Victuailles en stock<br /> 10252&#160;&#160; &#160;1996-07-09 00:00:00&#160;&#160; &#160;SUPRD&#160;&#160; &#160;51.3000&#160;&#160; &#160;Supr&#205;mes d&#200;lices<br /> 10253&#160;&#160; &#160;1996-07-10 00:00:00&#160;&#160; &#160;HANAR&#160;&#160; &#160;58.1700&#160;&#160; &#160;Hanari Carnes<br /> 10254&#160;&#160; &#160;1996-07-11 00:00:00&#160;&#160; &#160;CHOPS&#160;&#160; &#160;22.9800&#160;&#160; &#160;Chop-suey Chinese<br /> 10255&#160;&#160; &#160;1996-07-12 00:00:00&#160;&#160; &#160;RICSU&#160;&#160; &#160;148.3300&#160;&#160; &#160;Richter Supermarkt<br /> 10256&#160;&#160; &#160;1996-07-15 00:00:00&#160;&#160; &#160;WELLI&#160;&#160; &#160;13.9700&#160;&#160; &#160;Wellington Importadora<br /> 10257&#160;&#160; &#160;1996-07-16 00:00:00&#160;&#160; &#160;HILAA&#160;&#160; &#160;81.9100&#160;&#160; &#160;HILARI&#8221;N-Abastos<br /> Page&#160; of 83&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; View 1 &#8211; 10 of 830</p>
</p>
<p>great so far.</p>
</p>
<p>But to move to the full editable version the format seems to be different. See the code below.</p>
</p>
<p>&#60;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&#62;<br /> &#60;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&#62;<br /> &#60;head&#62;<br /> &#60;meta http-equiv="Content-Type" content="text/html; charset=utf-8&#8243; /&#62;<br /> &#60;title&#62;PHP jqGrid Class Example&#60;/title&#62; </p>
<p> &#60;link rel="stylesheet" type="text/css" media="screen" href="themes/redmond/jquery-ui-1.7.1.custom.css" /&#62;<br /> &#60;link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" /&#62;</p>
<p> &#60;script src="js/jquery-1.3.2.min.js" type="text/javascript"&#62;&#60;/script&#62;<br /> &#60;script src="js/i18n/grid.locale-en.js" type="text/javascript"&#62;&#60;/script&#62;<br /> &#60;script src="js/jquery.jqGrid.min.js" type="text/javascript"&#62;&#60;/script&#62;<br /> &#60;script type="text/javascript"&#62;<br /> jQuery(document).ready(function(){<br /> &#160;&#160; &#160;&#8230;.<br /> &#160;&#160; &#160;// Create the grid manually<br /> &#160;&#160; &#160;jQuery("#grid").jqGrid({<br /> &#160;&#160; &#160;&#160;&#160; &#160;"colModel":[<br /> &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160; {"name":"OrderID","index":"OrderID","label":"ID","width":60, "key":true},<br /> &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160; {"name":"OrderDate","index":"OrderDate", editable:true},<br /> &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160; {"name":"CustomerID","index":"CustomerID", editable:true},<br /> &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160; {"name":"Freight","index":"Freight", editable:true},<br /> &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160; {"name":"ShipName","index":"ShipName", editable:true}<br /> &#160;&#160; &#160;&#160;&#160; &#160;],<br /> &#160;&#160; &#160;&#160;&#160; &#160;"url":"gridData.php",<br /> &#160;&#160; &#160;&#160;&#160; &#160;"datatype":"json",<br /> &#160;&#160; &#160;&#160;&#160; &#160;"jsonReader":{repeatitems:false},<br /> &#160;&#160; &#160;&#160;&#160; &#160;"pager":"#pager",<br /> &#160;&#160; &#160;&#160;&#160; &#160;// now we should set the url where we post the data<br /> &#160;&#160; &#160;&#160;&#160; &#160;// in this case the same url<br /> &#160;&#160; &#160;&#160;&#160; &#160;"editurl": "gridData.php",<br /> &#160;&#160; &#160;&#160;&#160; &#160;<br /> &#160;&#160; &#160;&#160;&#160; &#160;// tell the grid to post the OrderID as primary key<br /> &#160;&#160; &#160;&#160;&#160; &#160;<br /> &#160;&#160; &#160;&#160;&#160; &#160;"prmNames":{"id":"OrderID"}<br /> &#160;&#160; &#160;&#160;&#160; &#160;<br /> &#160;&#160; &#160;&#160;&#160; &#160;});<br /> &#160;&#160; &#160;// Set navigator with all operations enabled.<br /> &#160;&#160; &#160;jQuery("#grid").jqGrid(&#39;navGrid&#39;,&#39;#pager&#39;,{add:true,edit:true,del:true});<br /> &#8230;&#8230;<br /> });<br /> &#60;/script&#62;</p>
<p> &#60;/head&#62;<br /> &#60;body&#62;<br /> &#8230;&#8230;<br /> &#160;&#160; &#160;&#60;table id="grid"&#62;&#60;/table&#62;<br /> &#160;&#160; &#160;&#60;div id="pager"&#62;&#60;/div&#62;<br /> &#8230;&#8230;<br /> &#60;/body&#62;<br /> &#60;/html&#62;</p>
</p>
<p>and the gridData.php is as follows:</p>
<p>&#60;?php<br /> define(&#39;DB_DSN&#39;,&#39;mysql:host=localhost;dbname=northwind&#39;);<br /> define(&#39;DB_USER&#39;, &#39;root&#39;);&#160;&#160;&#160;&#160; // Your MySQL username<br /> define(&#39;DB_PASSWORD&#39;, &#39;root&#39;); // &#8230;and password<br /> // include the jqGrid Class<br /> require_once "php/jqGrid.php";<br /> // include the PDO driver class<br /> require_once "php/jqGridPdo.php";<br /> // Connection to the server<br /> $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);</p>
<p> // Create the jqGrid instance<br /> $grid = new jqGrid($conn);<br /> // enable debugging<br /> $grid-&#62;debug = true;<br /> /// Write the SQL Query<br /> $grid-&#62;SelectCommand = &#39;SELECT OrderID, OrderDate, CustomerID, Freight, ShipName FROM orders&#39;;<br /> $grid-&#62;dataType = "json";<br /> $grid-&#62;queryGrid();<br /> ?&#62;</p>
<p>I have run gridData independently and it does produce data for the grid:</p>
<p>{"records":"830&#8243;,"page":1,"total":42,"rows":[{"OrderID":"10248","OrderDate":"1996-07-04  00:00:00","CustomerID":"WILMK","Freight":"32.3800","ShipName":"Vins et  alcools Chevalier"},{"OrderID":"10249","OrderDate":"1996-07-05  00:00:00","CustomerID":"TRADH","Freight":"11.6100","ShipName":null},{"OrderID":"10250","OrderDate":"1996-07-08  00:00:00","CustomerID":"HANAR","Freight":"65.8300","ShipName":"Hanari  Carnes"},{"OrderID":"10251","OrderDate":"1996-07-08  00:00:00","CustomerID":"VICTE","Freight":"41.3400","ShipName":"Victuailles  en stock"},{"OrderID":"10252","OrderDate":"1996-07-09  00:00:00","CustomerID":"SUPRD","Freight":"51.3000","ShipName":null},{"OrderID":"10253","OrderDate":"1996-07-10  00:00:00","CustomerID":"HANAR","Freight":"58.1700","ShipName":"Hanari  Carnes"},{"OrderID":"10254","OrderDate":"1996-07-11  00:00:00","CustomerID":"CHOPS","Freight":"22.9800","ShipName":"Chop-suey  Chinese"},{"OrderID":"10255","OrderDate":"1996-07-12  00:00:00","CustomerID":"RICSU","Freight":"148.3300","ShipName":"Richter  Supermarkt"},{"OrderID":"10256","OrderDate":"1996-07-15  00:00:00","CustomerID":"WELLI","Freight":"13.9700","ShipName":"Wellington  Importadora"},{"OrderID":"10257","OrderDate":"1996-07-16  00:00:00","CustomerID":"HILAA","Freight":"81.9100","ShipName":null},{"OrderID":"10258","OrderDate":"1996-07-17  00:00:00","CustomerID":"ERNSH","Freight":"140.5100","ShipName":"Ernst  Handel"},{"OrderID":"10259","OrderDate":"1996-07-18  00:00:00","CustomerID":"CENTC","Freight":"3.2500","ShipName":"Centro  comercial Moctezuma"},{"OrderID":"10260","OrderDate":"1996-07-19  00:00:00","CustomerID":"OLDWO","Freight":"55.0900","ShipName":null},{"OrderID":"10261","OrderDate":"1996-07-19   00:00:00","CustomerID":"QUEDE","Freight":"3.0500","ShipName":null},{"OrderID":"10262","OrderDate":"1996-07-22   00:00:00","CustomerID":"RATTC","Freight":"48.2900","ShipName":"Rattlesnake  Canyon Grocery"},{"OrderID":"10263","OrderDate":"1996-07-23  00:00:00","CustomerID":"ERNSH","Freight":"146.0600","ShipName":"Ernst  Handel"},{"OrderID":"10264","OrderDate":"1996-07-24  00:00:00","CustomerID":"FOLKO","Freight":"3.6700","ShipName":null},{"OrderID":"10265","OrderDate":"1996-07-25   00:00:00","CustomerID":"BLONP","Freight":"55.2800","ShipName":null},{"OrderID":"10266","OrderDate":"1996-07-26  00:00:00","CustomerID":"WARTH","Freight":"25.7300","ShipName":"Wartian  Herkku"},{"OrderID":"10267","OrderDate":"1996-07-29  00:00:00","CustomerID":"FRANK","Freight":"208.5800","ShipName":"Frankenversand"}]}</p>
</p>
<p>But when I run the main html &#8211; nothing but the dots &#8230;&#8230;.&#160;</p>
</p>
<p>Am I missing some sort of call to the function call to "#grid" in the body of html?</p>
<p>Unfortunately from what I have read, I cannot make jqGridEdit work in the first format.</p>
</p>
<p>Please, anybody who can put me on the correct path &#8211; I would be very grateful.</p>
</p>
<p>Steve.</p>
</p>
<p>PS Would it have anything to with the fact that I am running all of this on localhost and not over an internet URL?</p>
<p>[Image Can Not Be Found]</p>
]]></description>
        	        	<pubDate>Sun, 06 Feb 2011 13:08:53 +0200</pubDate>
        </item>
</channel>
</rss>