<?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: Paging, Sorting and appending with Local Data</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data</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/paging-sorting-and-appending-with-local-data/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>MaximG on Paging, Sorting and appending with Local Data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20064</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20064</guid>
        	        	<description><![CDATA[<p>For anyone interested please refer to <a href="http://www.trirand.com/blog/?page_id=393/bugs/rowid-parameter-in-addrowdata-does-not-function-correctly/" rel="nofollow" target="_blank"><a href="http://www.trirand.com/blog/?p" rel="nofollow">http://www.trirand.com/blog/?p</a>.....correctly/</a> for solution.</p>
]]></description>
        	        	<pubDate>Wed, 29 Sep 2010 10:33:34 +0300</pubDate>
        </item>
        <item>
        	<title>MaximG on Paging, Sorting and appending with Local Data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20061</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20061</guid>
        	        	<description><![CDATA[<p>I can confirm without question that this is a bug. (Will post in bug forum)</p>
<p>Still trying to work out how to fix it.</p>
</p>
<p>Code to recreate problem:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7538' value='Select Code' data-codeid='sfcode7538' /></p>
<div class='sfcode' id='sfcode7538'>&#160;$(function () {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#34;#tableSearch&#34;).jqGrid({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: &#34;local&#34;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colNames: [&#39;Type&#39;, &#39;Description&#39;, &#39;Options&#39;],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colModel: [{ name: &#39;Type&#39;, index: &#39;Type&#39;, width: 50, align: &#34;center&#34; },<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;&#160;&#160;&#160; { name: &#39;Description&#39;, index: &#39;Description&#39;, width: 230, sortable: true },<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;&#160;&#160;&#160; { name: &#39;Options&#39;, index: &#39;Options&#39;, width: 69, sortable: false}],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowNum: 10,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortname: &#39;type&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortorder: &#34;desc&#34;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; id: &#34;RowID&#34;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; caption: &#34;Search&#34;,&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowList: [10, 20, 30],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pager: &#34;#divPager&#34;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; gridComplete: function () {<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;&#160;&#160; })<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; });</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; function GoGoGo() {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#34;#tableSearch&#34;).clearGridData();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#34;#tableSearch&#34;).addRowData(&#34;RowID&#34;, [{ RowID: &#34;101&#34;, Type: &#34;Type&#34;, Description: &#34;Desc&#34;, Options: &#34;Option&#34; }, { RowID: &#34;102&#34;, Type: &#34;Type&#34;, Description: &#34;Desc&#34;, Options: &#34;Option&#34;}]);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#34;#tableSearch&#34;).trigger(&#34;reloadGrid&#34;);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var test1 = $(&#34;#tableSearch&#34;).getDataIDs();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; debugger;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Will return ID of 1 for row 1<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
</div>
]]></description>
        	        	<pubDate>Wed, 29 Sep 2010 09:20:11 +0300</pubDate>
        </item>
        <item>
        	<title>MaximG on Paging, Sorting and appending with Local Data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20043</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20043</guid>
        	        	<description><![CDATA[<p>After all that it doesnt work. It only worked with my test data as I was using integers for my IDs in my test.</p>
</p>
<p>There appears to be some specialized code inside the addRowData method that (ONLY IN THE CASE OF LOCAL DATA) deletes the predefined key and sets it to the length of the data array. (I Could be wrong though - still testing where its happening exactly)</p>
</p>
<p>This is the code here (at least I think)</p>
<pre><p><input type='button' class='sfcodeselect' name='sfselectit5175' value='Select Code' data-codeid='sfcode5175' /></p><div class='sfcode' id='sfcode5175'>if(t.p.datatype&#160;==&#160;&#39;local&#39;)&#160;{<br /> <br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160; t.p._index[rowid]&#160;=&#160;t.p.data.length;<br /> <br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160; t.p.data.push(lcdata);<br /> <br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160; lcdata&#160;=&#160;{};<br /><br /> }</div><br /></pre>
</p>
<p>Anyone care to comment?</p>
]]></description>
        	        	<pubDate>Tue, 28 Sep 2010 08:16:38 +0300</pubDate>
        </item>
        <item>
        	<title>MaximG on Paging, Sorting and appending with Local Data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20042</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20042</guid>
        	        	<description><![CDATA[<p>OK so for anyone interested I ended up looking at the source code and worked it out....</p>
</p>
<p>The first param of the addRowData method is actually the NAME of the id column in your dataset...</p>
</p>
<p>So basically this is how you would do it...</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4964' value='Select Code' data-codeid='sfcode4964' /></p>
<div class='sfcode' id='sfcode4964'>
<p>var data =&#160; [{&#160;id: &#34;ROW1ID&#34; , param1: &#34;&#34;, param2: &#34;&#34;, param3: &#34;&#34;, (Ect)......&#160; },</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {&#160;id: &#34;ROW2ID&#34; , param1: &#34;&#34;, param2: &#34;&#34;, param3: &#34;&#34;, (Ect)......&#160; }];</p>
</p>
<p>jQuery(&#34;#grid_id&#34;).addRowData(&#34;id&#34;, data);</p>
</div>
<p><strong>WORKS A CHARM!!!</strong></p>
</p>
<p>Thanks so much for your help Oleg...</p>
]]></description>
        	        	<pubDate>Tue, 28 Sep 2010 07:59:40 +0300</pubDate>
        </item>
        <item>
        	<title>MaximG on Paging, Sorting and appending with Local Data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20041</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20041</guid>
        	        	<description><![CDATA[<p>Thank you so much. I was unaware you could pass an array into that method.</p>
</p>
<p>One last issue I am having with is how to pass in the IDs for each row.</p>
</p>
<p>Passing an array of IDs to the .addRowData() method doesnt seem to work, nor does passing an ID parameter as part of the data definition. Could you advise what I might be doing wrong?</p>
</p>
<p>Have tried&#8230;</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9775' value='Select Code' data-codeid='sfcode9775' /></p>
<div class='sfcode' id='sfcode9775'>
<p>var data = [{&#160;id: &#34;ROW1ID&#34; , param1: &#34;&#34;, param2: &#34;&#34;, param3: &#34;&#34;, (Ect)......&#160; },</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {&#160;id: &#34;ROW2ID&#34; , param1: &#34;&#34;, param2: &#34;&#34;, param3: &#34;&#34;, (Ect)......&#160; }]</p>
</p>
<p>&#160;jQuery(&#34;#grid_id&#34;).addRowData(null, data);</p>
</div>
<p>and have tried</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5204' value='Select Code' data-codeid='sfcode5204' /></p>
<div class='sfcode' id='sfcode5204'>
<p>var data =&#160; [{ param1: &#34;&#34;, param2: &#34;&#34;, param3: &#34;&#34;, (Ect)......&#160; },</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { param1: &#34;&#34;, param2: &#34;&#34;, param3: &#34;&#34;, (Ect)......&#160; }]</p>
<p>var IDs = [ &#34;ID1&#34;, &#34;ID2&#34; ]</p>
</p>
<p>jQuery(&#34;#grid_id&#34;).addRowData(IDs, data);</p>
</div>
<p>Neither of which have seemed to work and simply return an array of "undefined" for the method getDataIDs().</p>
</p>
<p>Thanks again for all your help and so sorry to be a pest. Hopefully this post will be useful to someone else also. <img class="wp-smiley" src="/blog/wp-includes/images/smilies/icon_smile.gif" alt=":-)" /></p></p>
]]></description>
        	        	<pubDate>Tue, 28 Sep 2010 07:25:04 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on Paging, Sorting and appending with Local Data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20017</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20017</guid>
        	        	<description><![CDATA[<p>You can use <a href="/jqgridwiki/doku.php?id=wiki:retrieving_data#array_data" target="_blank">addRowData</a>&#160;method to add not only one row. The <strong>data</strong> parameter can be also array or row items, which can also include the <strong>id</strong> value for every new row. You can also use it in the form</p>
<p>&#160;&#160; &#160;jQuery("#grid_id").addRowData(rowid,data)</p>
<p>to add multiple rows or use</p>
<p>&#160;&#160; &#160;jQuery("#grid_id").getRowData()</p>
<p>to get all data from the grid.</p>
<p>Best regards<br />Oleg&#160;</p>
]]></description>
        	        	<pubDate>Mon, 27 Sep 2010 12:50:11 +0300</pubDate>
        </item>
        <item>
        	<title>MaximG on Paging, Sorting and appending with Local Data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20015</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20015</guid>
        	        	<description><![CDATA[<blockquote>
<p>OlegK said:</p>
<p>You can use <a href="/jqgridwiki/doku.php?id=wiki:retrieving_data#array_data" target="_blank">addRowData</a> method.</p>
<p>Best regards<br />Oleg&#160;</p>
</blockquote>
<hr />
<p>My concern with addRowData was what happens if you have a large dataset? Seems to me like the performance might end up being an issue (given that you are adding one row at a time), no?</p>
</p>
<p>Further it seemed to cause issues with paging (although those issues seem to disappear if I call .trigger("reloadGrid"); )</p>
</p>
<p>Is this considered the optimal solution?</p>
]]></description>
        	        	<pubDate>Mon, 27 Sep 2010 10:05:41 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on Paging, Sorting and appending with Local Data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20014</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20014</guid>
        	        	<description><![CDATA[<p>You can use <a href="/jqgridwiki/doku.php?id=wiki:retrieving_data#array_data" target="_blank">addRowData</a> method.</p>
<p>Best regards<br />Oleg&#160;</p>
]]></description>
        	        	<pubDate>Mon, 27 Sep 2010 09:58:18 +0300</pubDate>
        </item>
        <item>
        	<title>MaximG on Paging, Sorting and appending with Local Data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20013</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/paging-sorting-and-appending-with-local-data#p20013</guid>
        	        	<description><![CDATA[<p>Could someone please be kind enough to advise how I can add data to the grid when using datatype: "local" and when I do not want to add the data during the instantiation of the grid using the data: option?</p>
</p>
<p>(My goal is to create a blank grid and populate it as the user types from a local variable so obviously recreating the grid in such a scenario after every keystroke would be a bad idea)</p>
</p>
<p>.addJSONData() doesnt work (as this seems to be designed to work only with webservices)</p>
</p>
<p>So what are my options?</p>
</p>
<p>Thanks in advance for any help <img class="wp-smiley" src="/blog/wp-includes/images/smilies/icon_smile.gif" alt=":-)" /></p>
</p>
<p>PS: THANK YOU GUYS FOR CREATING SUCH AN AMAZING PRODUCT&#8230; (I wish we had such a fully featured grid in forms applications)</p>
]]></description>
        	        	<pubDate>Mon, 27 Sep 2010 08:58:50 +0300</pubDate>
        </item>
</channel>
</rss>