<?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: Cant edit records in a grid using SQL server 2005</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/cant-edit-records-in-a-grid-using-sql-server-2005</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/cant-edit-records-in-a-grid-using-sql-server-2005/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Cant edit records in a grid using SQL server 2005</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cant-edit-records-in-a-grid-using-sql-server-2005#p24579</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cant-edit-records-in-a-grid-using-sql-server-2005#p24579</guid>
        	        	<description><![CDATA[<p>Hello,</p>
</p>
<p>It seems you use the commertial PHP jqGrid.</p>
<p>Please post your problem here:</p>
<p><a href="http://www.trirand.net/forum/" rel="nofollow" target="_blank">http://www.trirand.net/forum/</a></p>
</p>
<p>Regards</p>
]]></description>
        	        	<pubDate>Sat, 10 Sep 2011 08:39:24 +0300</pubDate>
        </item>
        <item>
        	<title>eradom78 on Cant edit records in a grid using SQL server 2005</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cant-edit-records-in-a-grid-using-sql-server-2005#p24576</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cant-edit-records-in-a-grid-using-sql-server-2005#p24576</guid>
        	        	<description><![CDATA[<p>I can&#39;t seem to be able to edit records in my grid.&#160; My sql connection works fine and I get data in the grid however, editing does not work at all.&#160; For some reason my primary key is being posted as a sequential number of a record in my grid instead of actual field.</p>
<p>Also my table has two primary keys how would that work?</p>
</p>
<p>What am I doing wrong here?<img class="spSmiley" style="margin:0" title="Frown" src="/blog/wp-content/forum-smileys/sf-frown.gif" alt="Frown" /></p>
</p>
<p>here is my code.</p>
<p>//require_once &#39;jq-config.php&#39;;<br />// include the jqGrid Class</p>
<p>require_once "php/jqGrid.php";<br />require_once "php/jqGridSqlsrv.php";</p>
<p>// include the PDO driver class</p>
<p>$connectionInfo = array("Database"=&#62;"CDO_master_res","CharacterSet" =&#62; "utf-8","ReturnDatesAsStrings" =&#62; true);<br />$serverName = "NYSQL1";<br />$conn = sqlsrv_connect( $serverName, $connectionInfo);<br />// Create the jqGrid instance<br />$grid = new jqGridRender($conn);</p>
<p>$grid-&#62;debug = true;<br />// Write the SQL Query castselect cast(checkid as varchar(5))+&#39;_&#39;+cast(updateid as varchar(6))as pkid,<br />$grid-&#62;SelectCommand = "select checkid , updateid , pass , threshold , detail , CONVERT(nvarchar(20), update_date, 101) as update_date , duration, notes from qa_checks_results_pre";<br />// set the ouput format to json<br />$grid-&#62;dataType = &#39;json&#39;;<br />$grid-&#62;table = &#39;dbo.qa_checks_results_pre&#39;;<br />$grid-&#62;setPrimaryKeyId(&#39;checkid&#39;);<br />$grid-&#62;serialKey = false;</p>
<p>// Let the grid create the model</p>
<p>$Model = array(<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; array("name"=&#62;"checkid", "label"=&#62;"checkid", "width"=&#62;20, "align"=&#62;"right","editable"=&#62;false),//, "editable"=&#62;false<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; array("name"=&#62;"updateid",&#160; "label"=&#62;"updateid", "width"=&#62;100,"editable"=&#62;false),<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; array("name"=&#62;"pass", "label"=&#62;"pass", "width"=&#62;100),<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; array("name"=&#62;"threshold", "label"=&#62;"threshold", "width"=&#62;150,"editable"=&#62;false),<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; array("name"=&#62;"detail", "detail"=&#62;"tested", "width"=&#62;250,"editable"=&#62;false),<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; array("name"=&#62;"update_date", "label"=&#62;"update_date", "width"=&#62;150,"editable"=&#62;false),<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; array("name"=&#62;"duration", "label"=&#62;"duration", "width"=&#62;150,"editable"=&#62;false),<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; array("name"=&#62;"notes", "label"=&#62;"notes", "width"=&#62;300)<br />);</p>
<p>$grid-&#62;setColModel($Model );<br />// Set the url from where we obtain the data<br />$grid-&#62;addCol(array(<br />&#160;&#160;&#160; "name"=&#62;"actions",<br />&#160;&#160;&#160; "formatter"=&#62;"actions",<br />&#160;&#160;&#160; "editable"=&#62;false,<br />&#160;&#160;&#160; "sortable"=&#62;false,<br />&#160;&#160;&#160; "resizable"=&#62;false,<br />&#160;&#160;&#160; "fixed"=&#62;true,<br />&#160;&#160; "width"=&#62;60,<br />&#160;&#160; "formatoptions"=&#62;array("keys"=&#62;true)<br />&#160;&#160;&#160; ), "first");<br />$grid-&#62;setUrl(&#39;myfirstgrid.php&#39;);<br />// Set grid caption using the option caption<br />// Enable navigator<br />$grid-&#62;setColProperty(&#39;checkid&#39;, array("editrules"=&#62;array("required"=&#62;true)));<br />$grid-&#62;setColProperty(&#39;updateid&#39;, array("editrules"=&#62;array("required"=&#62;true)));</p>
<p>$grid-&#62;navigator = true;<br />$grid-&#62;setNavOptions(&#39;navigator&#39;, array("excel"=&#62;true,"add"=&#62;true,"edit"=&#62;true,"del"=&#62;true,"view"=&#62;true));<br />$grid-&#62;setNavOptions(&#39;edit&#39;,array("closeAfterEdit"=&#62;true,"editCaption"=&#62;"Edit QA Results","bSubmit"=&#62;"Submit"));<br />$grid-&#62;setGridOptions(array(<br />&#160;&#160;&#160; "caption"=&#62;"QA MACRO",<br />&#160;&#160;&#160; "rowNum"=&#62;20,<br />&#160;&#160;&#160; "sortname"=&#62;"updateid",<br />&#160;&#160;&#160; "hoverrows"=&#62;true,<br />&#160;&#160;&#160; "height"=&#62;"auto",<br />&#160;&#160;&#160; "width"=&#62;900,<br />&#160;&#160;&#160; "rowList"=&#62;array(20,40,60)<br />&#160;&#160;&#160; ));<br />// Change some property of the field(s)<br />//$pkid = jqGridUtils::GetParam(&#39;pkid&#39;);<br />//$checkid = jqGridUtils::GetParam(&#39;checkid&#39;);<br />//$updateid= jqGridUtils::GetParam(&#39;updateid&#39;);<br />//$notes = jqGridUtils::GetParam(&#39;notes&#39;);<br />//$pass= jqGridUtils::GetParam(&#39;pass&#39;);</p>
<p>//if ($_SESSION[&#39;updateid&#39;]){<br />//$sql = "UPDATE qa_checks_results_pre SET pass =&#39;". $pass ."&#39;,notes = &#39;".$notes."&#39; where cast(checkid as varchar(5))+&#39;_&#39;+cast(updateid as varchar(6))".$pkid.";" ;<br />//$_SESSION[&#39;sql&#39;] = $sql ;<br />//$grid-&#62;setAfterCrudAction(&#39;edit&#39;,"UPDATE qa_checks_results_pre SET pass =&#39;". $pass ."&#39;,notes = &#39;".$notes."&#39; where cast(checkid as varchar(5))+&#39;_&#39;+cast(updateid as varchar(6))=".$pkid.";" );<br />//}<br />////"UPDATE qa_checks_results_pre SET pass =?, notes = ? where updateid=? and checkid =?;",array($pass, $notes, $updateid, $checkid&#160; )</p>
<p>$grid-&#62;toolbarfilter = true;<br />$grid-&#62;setFilterOptions(array("stringResult"=&#62;true));<br />// Enjoy<br />$grid-&#62;renderGrid(&#39;#grid&#39;,&#39;#pager&#39;,true, null, null, true,true);<br />$conn = null;</p>
]]></description>
        	        	<pubDate>Sat, 10 Sep 2011 00:32:26 +0300</pubDate>
        </item>
</channel>
</rss>