<?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: How to pass data of the cell from jqGrid to the "cellurl" </title>
	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl</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/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>OlegK on How to pass data of the cell from jqGrid to the "cellurl" </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19605</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19605</guid>
        	        	<description><![CDATA[<p>If your beforeSubmitCell function will returns an object it will be combined with the postdata. For example is you fill use</p>
<p>&#160;&#160; &#160;beforeSubmitCell : function(rowid,celname,value,iRow,iCol) {<br /><span style="font-size: 13.8889px;">&#160;&#160; &#160; &#160; &#160;return {tableName: "myTableName", tableNameId: "myTableNameId"}<br /><span style="font-size: 13.8889px;">&#160;&#160; &#160;}</span></span></p>
<p>then the posted data will looks like</p>
<p>&#160;&#160; &#160;tableName=myTableName&#38;tableNameId=myTableNameId&#38;Col=NewData&#38;id=2&#38;oper=edit</p>
<p>So with respect of beforeSubmitCell&#160;you can put/override&#160;any information send during cell editing.</p>
<p>Regards<br />Oleg&#160;</p>
<p>P.S. How could I see I write slowly as you. 🙂</p>
]]></description>
        	        	<pubDate>Wed, 08 Sep 2010 18:00:12 +0300</pubDate>
        </item>
        <item>
        	<title>sibbim on How to pass data of the cell from jqGrid to the "cellurl" </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19604</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19604</guid>
        	        	<description><![CDATA[<p>After all - it was pretty easy 😉</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1755' value='Select Code' data-codeid='sfcode1755' /></p>
<div class='sfcode' id='sfcode1755'>&#160;&#160; &#160;&#160;&#160;&#160; beforeSubmitCell : function(rowid,celname,value,iRow,iCol) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;//alert (rowid +&#34;/&#34;+celname+&#34;/&#34;+value+&#34;/&#34;+iRow+&#34;/&#34;+iCol);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;return {tableNameId:tableNameId,tableName:tableName}; <br />&#160;&#160; &#160;&#160;&#160; &#160;},</div>
<p>
I hope I could help you 😉</p>
]]></description>
        	        	<pubDate>Wed, 08 Sep 2010 17:50:11 +0300</pubDate>
        </item>
        <item>
        	<title>sibbim on How to pass data of the cell from jqGrid to the "cellurl" </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19600</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19600</guid>
        	        	<description><![CDATA[<p>Hi Oleg,</p>
</p>
<p>thanks for your reply - I found the other parameter...</p>
<p>...However - I also need the table name and the primary key. My idea was to use</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4086' value='Select Code' data-codeid='sfcode4086' /></p>
<div class='sfcode' id='sfcode4086'>ajaxCellOptions: {data: &#34;tableName=&#34;+tableName+&#34;&#38;tableNameId=&#34;+tableNameId}</div>
<p>This works pretty good - BUT... this overwrites the jqGrid parameters (Col=NewData&#38;id=2&#38;oper=edit)</p>
<p>I also tried it this way:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7332' value='Select Code' data-codeid='sfcode7332' /></p>
<div class='sfcode' id='sfcode7332'>ajaxCellOptions: {data: &#34;tableName=&#34;+tableName+&#34;&#38;tableNameId=&#34;+tableNameId+&#34;&#38;rowid=&#34;+rowid+&#34;&#38;cellname=&#34;+cellname+&#34;&#38;value=&#34;+value},</div>
<p>But it seems that the variables are not known at this stage - and this is why it doesn&#39;t show the grid than.</p>
</p>
<p>Nevertheless, is this the right way to pass additional parameters to the PHP?</p>
</p>
<p>Thanks,</p>
</p>
<p>Sebastian</p>
]]></description>
        	        	<pubDate>Wed, 08 Sep 2010 16:57:03 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on How to pass data of the cell from jqGrid to the "cellurl" </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19598</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19598</guid>
        	        	<description><![CDATA[<p>You can use <a href="http://www.fiddler2.com/fiddler2/" target="_blank">Fiddler</a>&#160;to see all data which will be send or returned from the server. If you use it with the localhost you should use ipv4.fiddler instead of the localhost.</p>
<p>The data look like</p>
<p>Col=NewData&#38;id=2&#38;oper=edit</p>
<p>where Col is the column name like you define it in the colModel, NewData is the value which the user enter in the cell, the meaning of id and oper is clear.</p>
<p>Regards<br />Oleg&#160;</p>
]]></description>
        	        	<pubDate>Wed, 08 Sep 2010 16:45:02 +0300</pubDate>
        </item>
        <item>
        	<title>sibbim on How to pass data of the cell from jqGrid to the "cellurl" </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19597</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19597</guid>
        	        	<description><![CDATA[<p>and thats the way to get the id 😉</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2694' value='Select Code' data-codeid='sfcode2694' /></p>
<div class='sfcode' id='sfcode2694'>$rowid &#160;&#160; &#160;&#160;&#160; &#160;= isset($_POST[&#39;id&#39;]) ? $_POST[&#39;id&#39;]: false;</div>
</p>
<p>only the column name is missing</p>
]]></description>
        	        	<pubDate>Wed, 08 Sep 2010 16:26:45 +0300</pubDate>
        </item>
        <item>
        	<title>sibbim on How to pass data of the cell from jqGrid to the "cellurl" </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19596</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19596</guid>
        	        	<description><![CDATA[<p>It&#39;s getting clearer now...</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1470' value='Select Code' data-codeid='sfcode1470' /></p>
<div class='sfcode' id='sfcode1470'>$celname &#160;&#160; &#160;= isset($_POST[&#39;orig_country&#39;]) ? $_POST[&#39;orig_country&#39;]: false;</div>
<p>I&#39;m able to get the value when I use the name of the column directly.</p>
<p>Now I just need the column name itself and the rowid - any ideas on that?</p></p>
]]></description>
        	        	<pubDate>Wed, 08 Sep 2010 16:18:19 +0300</pubDate>
        </item>
        <item>
        	<title>sibbim on How to pass data of the cell from jqGrid to the "cellurl" </title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19591</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-pass-data-of-the-cell-from-jqgrid-to-the-cellurl#p19591</guid>
        	        	<description><![CDATA[<p>Hi Everybody,</p>
</p>
<p>I&#39;m pretty new to jqGrid and I understand already lot of thinks. However I&#39;m not able to pass</p>
<p>the data after a cellchange to my update php script.</p>
</p>
<p>View a few words:</p>
</p>
<p>1. I build the jqGrid with the option:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9750' value='Select Code' data-codeid='sfcode9750' /></p>
<div class='sfcode' id='sfcode9750'>cellurl: &#39;se/ref_mgmnt_save.php&#39;,</div>
<p>I can see the grid with all data and when I click on a cell it becomes editable.</p>
</p>
<p>2. After pressing the Return-Key I want this data to be stored in the MySQL database:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4985' value='Select Code' data-codeid='sfcode4985' /></p>
<div class='sfcode' id='sfcode4985'>$queryUpdate = &#34;UPDATE table SET &#34;.$celname.&#34;=&#39;&#34;.$value.&#34;&#39; WHERE table_id=&#39;&#34;.$rowid.&#34;&#39;;&#34;;</div>
<p>Well, and this is my problem. The PHP-File "se/ref_mgmnt_save.php" is called but the data is not stored in the database because the PHP script doesn&#39;t know the celname (column name from grid), value (the new value in this column) and the rowid (the primary key).</p>
</p>
<p>The Wiki says (<a title="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:cell_editing" href="/jqgridwiki/doku.php?id=wiki:cell_editing" target="_blank"></a><a href="http://www.trirand.com/jqgridw" rel="nofollow" target="_blank">http://www.trirand.com/jqgridw</a>.....ll_editing)</p>
<p>"The rowid and the cell content are added to the url as name:value pairs. For example, if we save the cell named mycell,{id: rowid, mycell: cellvalue} is added to the url."</p>
</p>
<p>Sorry, but I don&#39;t have any idea what is ment by this and how I can refer to the data in my PHP-Script. I think without a hint from your site I&#39;m totally lost <img class="spSmiley" style="margin:0" title="Cry" src="/blog/wp-content/forum-smileys/sf-cry.gif" alt="Cry" /></p>
</p>
<p>More detailed - my Javascript file:</p>
</p>
<p>getColumnHeader is just a function to populate the jqgrid with all columns from the corresponding table. This works pretty fine.</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4141' value='Select Code' data-codeid='sfcode4141' /></p>
<div class='sfcode' id='sfcode4141'>function loadRefMgmnt(tableName){<br />&#160;&#160; &#160;<br />&#160;&#160; &#160;var tableNameId = tableName + &#34;_id&#34;;<br />&#160;&#160; &#160;var columnHeader = getColumnHeader(tableName, &#34;&#34;, &#34;&#34;);<br />&#160;&#160; &#160;var columnHeader2 = getColumnHeader2(tableName, &#34;&#34;, &#34;&#34;);<br />&#160;&#160; &#160;<br />&#160;&#160; &#160;$(&#34;#ref_mgmnt&#34;).jqGrid({<br />&#160;&#160; &#160;&#160;&#160; &#160;url:&#39;se/ref_mgmnt.php&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;datatype: &#34;json&#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;height: 450,<br />&#160;&#160; &#160;&#160;&#160; &#160;width: 1100, <br />&#160;&#160; &#160;&#160;&#160; &#160;colNames: columnHeader2,<br />&#160;&#160; &#160;&#160;&#160; &#160;colModel: columnHeader, <br />&#160;&#160; &#160;&#160;&#160; &#160;rowNum: 50,<br />&#160;&#160; &#160;&#160;&#160; &#160;rowTotal: 2000,<br />&#160;&#160; &#160;&#160;&#160; &#160;rowList : [20,30,50],<br />&#160;&#160; &#160;&#160;&#160; &#160;scroll:1,<br />&#160;&#160; &#160;&#160;&#160; &#160;loadonce:true,<br />&#160;&#160; &#160;&#160;&#160; &#160;mtype: &#34;GET&#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;gridview: true,<br />&#160;&#160; &#160;&#160;&#160; &#160;pager: &#39;#ref_mgmnt_pager&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;sortname: &#39;item_id&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;viewrecords: true,<br />&#160;&#160; &#160;&#160;&#160; &#160;sortorder: &#34;asc&#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;caption: &#34;Reference data&#34;,<br />&#160;&#160; &#160;&#160;&#160; &#160;cellEdit: true,<br />&#160;&#160; &#160;&#160;&#160; &#160;cellurl: &#39;se/ref_mgmnt_save.php&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;afterSubmitCell: function(serverresponse, rowid, cellname, value, iRow, iCol) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;alert (serverresponse.responseText);<br />&#160;&#160; &#160;&#160;&#160; &#160;},<br />&#160;&#160; &#160;&#160;&#160; &#160;beforeSubmitCell : function(rowid,celname,value,iRow,iCol) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;var varCellUrl = &#39;se/ref_mgmnt_save.php&#39;;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;//alert (rowid +&#34;/&#34;+celname+&#34;/&#34;+value+&#34;/&#34;+iRow+&#34;/&#34;+iCol);<br />&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;}); </p>
<p>&#160;&#160; &#160;$(&#34;#ref_mgmnt&#34;).jqGrid(&#39;navGrid&#39;,&#39;#ref_mgmnt_pager&#39;,{del:false,add:true,edit:false},{},{},{},{multipleSearch:true}); <br />}</p>
</div>
<p>2. And finally my PHP-File:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9075' value='Select Code' data-codeid='sfcode9075' /></p>
<div class='sfcode' id='sfcode9075'>&#60;?php<br />&#160;&#160; &#160;require &#39;../settings.inc.php&#39;;<br />&#160;&#160; &#160;require BASE_DIR.&#39;/class/mysql.class.php&#39;;<br />&#160;&#160; &#160;<br />&#160;&#160; &#160;$celname &#160;&#160; &#160;= isset($_POST[&#39;celname&#39;]) ? $_POST[&#39;celname&#39;]: false;<br />&#160;&#160; &#160;$value&#160;&#160; &#160;&#160;&#160; &#160;= isset($_POST[&#39;value&#39;]) ? $_POST[&#39;value&#39;]: false;<br />&#160;&#160; &#160;$rowid &#160;&#160; &#160;&#160;&#160; &#160;= isset($_POST[&#39;rowid&#39;]) ? $_POST[&#39;rowid&#39;]: false;&#160;&#160; &#160;<br />&#160;&#160; &#160;</p>
<p>&#160;&#160; &#160;try {<br />&#160;&#160; &#160;&#160;&#160; &#160;$sql = new mysql ($_SESSION[&#39;db_server&#39;], $_SESSION[&#39;db_user&#39;], $_SESSION[&#39;db_pass&#39;], $_SESSION[&#39;db_name&#39;]);<br />&#160;&#160; &#160;&#160;&#160; &#160;$queryUpdate = &#34;UPDATE table SET &#34;.$celname.&#34;=&#39;&#34;.$value.&#34;&#39; WHERE table_id=&#39;&#34;.$rowid.&#34;&#39;;&#34;;<br />&#160;&#160; &#160;&#160;&#160; &#160;$result = $sql-&#62;mysqlGetData ($queryUpdate);<br />&#160;&#160; &#160;} catch (Exception $e) {<br />&#160;&#160; &#160;&#160;&#160; &#160;echo $e-&#62;getMessage();<br />&#160;&#160; &#160;&#160;&#160; &#160;exit();<br />&#160;&#160; &#160;}<br />&#160;&#160; &#160;<br />&#160;&#160; &#160;$total = mysql_affected_rows();<br />&#160;&#160; &#160; &#160;<br />&#160;&#160; &#160;// Return JSON data<br />&#160;&#160; &#160;$json = array();<br />&#160;&#160; &#160;$json[&#39;queryUpdate&#39;] = $queryUpdate;</p>
<p>&#160;&#160; &#160;// PHP json_encode not supported &#60; 5.1.6<br />&#160;&#160; &#160;require BASE_DIR.&#39;/class/json_encode.php&#39;;<br />&#160;&#160; &#160;echo json_encode($json);<br />&#160;&#160; &#160;<br />&#160;&#160; &#160;try {<br />&#160;&#160; &#160;&#160;&#160; &#160;$sql-&#62;mysqlCloseDb();<br />&#160;&#160; &#160;} catch (Exception $e) {<br />&#160;&#160; &#160;&#160;&#160; &#160;echo $e-&#62;getMessage();<br />&#160;&#160; &#160;&#160;&#160; &#160;exit();<br />&#160;&#160; &#160;}<br />?&#62;</p>
</div>
<p>Thanks,</p>
</p>
<p>Sebastian</p></p>
]]></description>
        	        	<pubDate>Wed, 08 Sep 2010 14:30:44 +0300</pubDate>
        </item>
</channel>
</rss>