<?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: AddrowData is not adding row at the top of the grid</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/addrowdata-is-not-adding-row-at-the-top-of-the-grid</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/addrowdata-is-not-adding-row-at-the-top-of-the-grid/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Viral Gala on AddrowData is not adding row at the top of the grid</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/addrowdata-is-not-adding-row-at-the-top-of-the-grid#p20355</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/addrowdata-is-not-adding-row-at-the-top-of-the-grid#p20355</guid>
        	        	<description><![CDATA[<table class="sfinnerposttable" border="0">
<tbody>
<tr>
<td class="sfpostcontent "><a id="p20354" target="_blank"></a></p>
<div id="post20354">
<p>Hi,</p>
</p>
<p>I wanted to add a new row on click of add button at the start of the grid</p>
<p>But&#160; the row are added at the bottom of the grid</p>
<p>Please tell me what I am doing wrong, so that the rows will be displayed at the start of the grid</p>
</p>
<p>jQuery(document).ready(function(){ <br />&#160; jQuery("#list4&#8243;).jqGrid({<br />&#160;datatype: "local",<br />&#160;height: "150&#8243;,<br />&#160;&#160; &#160;colNames:[&#39;Date&#39;, &#39;Client&#39;, &#39;Amount&#39;,&#39;Tax&#39;,&#39;Total&#39;,&#39;Notes&#39;],<br />&#160;&#160; &#160;colModel:[<br />&#160;&#160; &#160;&#160;<br />&#160;&#160; &#160;&#160;{name:&#39;invdate&#39;,index:&#39;invdate&#39;, width:90, sorttype:"date"},<br />&#160;&#160; &#160;&#160;{name:&#39;name&#39;,index:&#39;name&#39;, width:100},<br />&#160;&#160; &#160;&#160;{name:&#39;amount&#39;,index:&#39;amount&#39;, width:80, align:"right",sorttype:"float"},<br />&#160;&#160; &#160;&#160;{name:&#39;tax&#39;,index:&#39;tax&#39;, width:80, align:"right",sorttype:"float"},&#160;&#160;<br />&#160;&#160; &#160;&#160;{name:&#39;total&#39;,index:&#39;total&#39;, width:80,align:"right",sorttype:"float"},&#160;&#160;<br />&#160;&#160; &#160;&#160;{name:&#39;note&#39;,index:&#39;note&#39;, width:150, sortable:false}&#160;&#160;<br />&#160;&#160; &#160;],<br />&#160;&#160; &#160;multiselect: true,<br />&#160;scroll :1,<br />&#160;</p>
<p>&#160;&#160; &#160;caption: "Manipulating Array Data"<br />});</p>
<p>var mydata = [<br />&#160;&#160;{invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},<br />&#160;&#160;{invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},<br />&#160;&#160;{invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},<br />&#160;&#160;{invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},<br />&#160;&#160;{invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},<br />&#160;&#160;{invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},<br />&#160;&#160;{invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},<br />&#160;&#160;{invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},<br />&#160;&#160;{invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}<br />&#160;&#160;];</p>
<p>for(var i=0;i&#60;=mydata.length;i++)<br />&#160;jQuery("#list4&#8243;).jqGrid(&#39;addRowData&#39;,i+1,mydata[i]);<br />});</p>
<p>function add(){<br />var mydataadd = <br />&#160;&#160;[<br />&#160;&#160;{ida:"10",invdate:"2007-11-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},<br />&#160;&#160;{ida:"11",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}<br />&#160;&#160;];</p>
<p>&#160;&#160;jQuery("#list").addRowData("ida",mydataadd, &#39;first&#39;);</p>
<p>}</p>
</p>
<p>&#60;/script&#62;<br />&#160;<br />&#60;/head&#62;<br />&#60;body&#62;<br />&#60;table id="list4&#8243; class="scroll"&#62;&#60;/table&#62;</p>
<p>&#60;input type="button" onclick = "javascript:add();" value ="add" /&#62;</p>
</p>
<p>Thanks &#38; Regards,</p>
<p>Viral Gala</p>
</div>
</td>
</tr>
</tbody>
</table>
]]></description>
        	        	<pubDate>Tue, 19 Oct 2010 00:21:55 +0300</pubDate>
        </item>
</channel>
</rss>