<?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: Add new Data problem..</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/add-new-data-problem</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/add-new-data-problem/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>aznan on Add new Data problem..</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/add-new-data-problem#p15149</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/add-new-data-problem#p15149</guid>
        	        	<description><![CDATA[<p>just to add someinfo..&#160; it seem the jqgrid unable to refresh grid content&#8230;</p>
<p>as u can see if theres data exist.. my "ap_id" have value.. which will then pass to the "url" to populate the grid.</p>
</p>
<p>but I hv to get the "ap_id" externally from ajax call (success function) when a button is click. if theres no data exist/new record.&#160; only than I can send it to the navAddButton to add the data. i can send the first array of data BUT then mygrid is not &#39;refresh&#39; with the submitted data.. and later I cant even send data anymore!!!!!</p>
</p>
[spoiler]HEEEEEEEEELLLLLLLLLLLLLLPPPPPPPPPPPPPPPP !!![/spoiler]
<p>~newbie</p>
]]></description>
        	        	<pubDate>Thu, 25 Feb 2010 11:51:50 +0200</pubDate>
        </item>
        <item>
        	<title>aznan on Add new Data problem..</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/add-new-data-problem#p15143</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/add-new-data-problem#p15143</guid>
        	        	<description><![CDATA[</p>
<p>i hv an issue here&#8230;I&#39;m creating a system which record claim for our staff. and thing works ok if theres no new record/claim being made&#8230; (which is NOT possible accept my company is closed) FYI i&#39;m integrating the system by using jqgrid inside FACEBOX.</p>
<p>first thing first:</p>
<p>I hv 2 tables for data :</p>
<p>a) tbl_claim ~ data for claim e.g. name, date. [enter] it will generate "claim id"</p>
<p>b) tbl_claimdetail ~ Detail claim e.g. list of item claimed, amount, generate "detail claim id"</p>
<p>i hv these files</p>
<p>1. claim.php &#8211; (contain form + div &#38; table for jqgrid, + attach the claimgrid.js)</p>
<p>2.claimgrid.js &#8211; (contain the jqgrid properties)</p>
<p>3.claimdata.php &#8211; (for populating data inside jqgrid)</p>
<p>4.claimedit.php &#8211; (for update and insert data inside jqgrid)</p>
<p>5.claimid.php &#8211; (for inserting data inside &#39;tbl_claim&#39;)</p>
<p>&#160;I dont have problem when it involve adding data inside existing record i.e. I already have a claim record inside the"tbl_claim" and i only add data inside the grid into the "tbl_claimdetail".</p>
<p>But problem arise when I add new claim data&#8230;when user login to the system they will be given a form (claim.php) to keyin their detail e.g. name (from login session), date of claim, purpose etc. &#160; when the user submit the form and new record is being created (inside tbl_claim), I extract the "claim_id" through ajax success function. this data will be send to the custom button navButton as "ap_id" (FYI there are 2 ap_id inside &#39;claimgrid.js&#39; I did try different name but nothing change).. and the value is inserted inside row through addRowData.. before editRow being called..&#160; I managed to key in all data.. and when [enter] data is submitted to database.&#160;&#160;&#160;&#160;&#160;</p>
<p>BUUTT the grid is still in edit mode, and the row is not restored (I managed to get the row restored but the data is not there &#8211; the ROW is empty). and when I ADD another record the data is not send to the database..stuck inside the edit mode. so thats my problem I cant update the grid with the new data. and somehow the edit/add process is not working properly..</p>
<p>and now I&#39;m in a BIG MESSz!!!</p>
<p>below and the code inside the jqgrid.js &#8230; S.O.S</p>
<p>helppppp&#8230;. anyone&#8230;. tony?</p>
<p>Button and other function:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1081' value='Select Code' data-codeid='sfcode1081' /></p>
<div class='sfcode' id='sfcode1081'>
<p>jQuery(&#34;#claim&#34;).jqGrid(&#39;navButtonAdd&#39;,&#39;#pagerclaim&#39;,{caption:&#34;New&#34;, buttonicon :&#39;ui-icon-circle-plus&#39;, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; onClickButton:function(id){<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;jQuery(&#39;#claim&#39;).restoreRow(lastSel);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; var ap_id = $(&#34;#no&#34;).val();&#160;&#160; //grab id from the ajax succes function<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;var datarow = {int_claimid:ap_id};<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;jQuery(&#34;#claim&#34;).addRowData(&#34;0&#34;,datarow,&#34;first&#34;);<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;jQuery(&#39;#claim&#39;).editRow(&#34;0&#34;, true, pickdates, refresh);<br />&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160; lastSel = id;<br />&#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;title:&#34;New Record&#34;, <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;position:&#34;last&#34;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;});</p>
<p>function pickdates(id){<br />&#160;&#160;&#160; &#160;jQuery(&#34;#&#34;+id+&#34;_dt_date&#34;,&#34;#claim&#34;).datepicker({dateFormat:&#34;dd-mm-yy&#34;}); } <br />&#160;&#160; &#160;<br />function refresh(id){ &#160;&#160;&#160; <br />&#160;&#160; &#160;jQuery(&#39;#claim&#39;).trigger(&#34;reloadGrid&#34;);<br />&#160;&#160;&#160; }</p>
</div>
<p>Main Grid Data:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7827' value='Select Code' data-codeid='sfcode7827' /></p>
<div class='sfcode' id='sfcode7827'>
<p>jQuery(document).ready(function(){<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;<br />&#160; var lastSel;<br />&#160; <br />&#160; var ap_id = $(&#34;#no&#34;).val();<br />&#160; <br />&#160; jQuery(&#34;#claim&#34;).jqGrid({<br />&#160;&#160; &#160;url:&#39;form/claim_data.php?apid=&#39;+ap_id,<br />&#160;&#160; &#160;datatype: &#34;json&#34;,<br />&#160;&#160; &#160;colNames:[&#39;Claim Detail ID&#39;,&#39;Item&#39;,&#39;Claim ID&#39;, &#39;Date&#39;, &#39;Reference&#39;, &#39;Amount&#39;,&#160; &#39;Site ID&#39;,&#39;Acc ID&#39;],&#160;&#160; &#160; <br />&#160;&#160; &#160;colModel:[<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;int_claimdetailid&#39;,index:&#39;int_claimdetailid&#39;, align:&#34;center&#34;, width:110, hidden:true },<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;txt_item&#39;, index:&#39;txt_item&#39;, editable:true,&#160; align:&#34;center&#34;, width:150, stype:&#39;text&#39; },<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;int_claimid&#39;,index:&#39;int_claimid asc, txt_item&#39;, editable:true, align:&#34;center&#34;, width:50},<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;dt_date&#39;,index:&#39;dt_date&#39;, width:80, align:&#34;center&#34;, editable:true,formatter:&#39;date&#39;, editoptions:{dataInit:function(el){$(el).datepicker({dateFormat:&#39;yy-mm-dd&#39;});} }/*, formatoptions:{ rowpos:3,&#160; elmsuffix:&#34; * yyyy-mm-dd&#34; }*/ },<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;int_reference&#39;,index:&#39;int_reference&#39;, width:60, align:&#34;center&#34;, editable: true, editoptions:{size:&#34;20&#34;,maxlength:&#34;30&#34;}},<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;cur_amount&#39;,index:&#39;cur_amount&#39;, width:110, align:&#34;right&#34;,editable: true, formatter:&#39;currency&#39;, formatoptions:{decimalSeparator:&#34;.&#34;, thousandsSeparator: &#34;,&#34;, decimalPlaces: 2, prefix: &#34;RM &#34;, suffix: &#34;&#160; &#34;}},<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;int_siteid&#39;,index:&#39;int_siteid&#39;, width:50, align:&#34;center&#34;, editable: true, edittype:&#34;select&#34;, editoptions:{value:{1:&#39;1&#39;,2:&#39;2&#39;,3:&#39;3&#39;}} },<br />&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;int_accid&#39;,index:&#39;int_accid&#39;, width:50, align:&#34;center&#34;, editable: true, sortable:false }&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;],</p>
<p>&#160;&#160;&#160; pager: &#39;#pagerclaim&#39;, <br />&#160;&#160;&#160; rowNum:10,<br />&#160;&#160;&#160; rowList:[10,20,30],<br />&#160;&#160;&#160; height:&#39;100%&#39;,<br />&#160;&#160; &#160;sortname: &#39;int_claimdetailid&#39;,<br />&#160;&#160;&#160; sortorder: &#39;desc&#39;,<br />&#160;&#160;&#160; viewrecords: true, <br />&#160;&#160; &#160;editurl:&#34;form/claim_edit.php&#34;,<br />&#160;&#160; &#160;loadtext: &#34;tgh load tuk, jap lok&#8230;&#34;,<br />&#160;&#160; &#160;footerrow:true,<br />&#160;&#160;&#160; &#160;userDataOnFooter : true, <br />&#160;&#160; &#160;<br />&#160;onSelectRow : function(id){<br />&#160;&#160; if(id != null) {<br />&#160;&#160;&#160;&#160;&#160; if(id == lastSel) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160; jQuery(&#39;#claim&#39;).restoreRow(lastSel); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lastSel=id;<br />&#160;&#160;&#160;&#160;&#160; } else {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; jQuery(&#39;#claim&#39;).restoreRow(lastSel); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lastSel=id; <br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; alert (&#34;slctelse LstSel: &#34;+lastSel+&#34; ID: &#34;+id);<br />&#160;&#160;&#160;&#160;&#160; jQuery(&#39;#claim&#39;).editRow(id, true, pickdates, refresh); <br />&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160; }}<br />&#160;<br />});</p>
<p>});</p>
</div>
<p>[Image Can Not Be Found]<br /> [Image Can Not Be Found]</p>
]]></description>
        	        	<pubDate>Thu, 25 Feb 2010 08:50:17 +0200</pubDate>
        </item>
</channel>
</rss>