<?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: Local Data Paging &#38; Sorting</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/local-data-paging-sorting</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/local-data-paging-sorting/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>feto on Local Data Paging &#38; Sorting</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/local-data-paging-sorting#p21311</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/local-data-paging-sorting#p21311</guid>
        	        	<description><![CDATA[<p>Sorry for all the post :))) but am working through this now so my progress is currently fluid  New discovery (reference example in my post above):          grid.addJSONData(rr); //Adds data but local sort and paging NOT WORK         $("#Grid").jqGrid("addRowData", "Id", rr.rows); //adds data and local sort and paging WORKS!  Why?? And i guess i can use addRowData instead of addJSONData as long as performance is similar on large data sets?</p>
]]></description>
        	        	<pubDate>Thu, 16 Dec 2010 01:21:40 +0200</pubDate>
        </item>
        <item>
        	<title>feto on Local Data Paging &#38; Sorting</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/local-data-paging-sorting#p21310</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/local-data-paging-sorting#p21310</guid>
        	        	<description><![CDATA[<p>Even when I write a hardcoded example it does the same thing, data adds and displays fine but when I try and sort on the Name column (All Row Data disappears):</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $("#Grid").jqGrid({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: &#39;local&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; height: 255,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; width: 400,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colNames: [&#39;Id&#39;, &#39;Name&#39;],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colModel: [{ name: &#39;Id&#39;, index: &#39;Id&#39;, align: &#39;center&#39;, width: 20, hidden: true, key: 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;Name&#39;, index: &#39;Name&#39;, align: &#39;center&#39;, width: 40}],<br />&#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; rowList: [10, 20, 50],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; loadonce: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortname: &#39;Name&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortorder: "asc",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; caption: &#39;Hardcoded Example&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pager: &#39;#Pager&#39;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; });</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; var grid = $("#Grid")[0];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var r = &#39;{"rows":[{"Id":75,"Name":"JoeK"},{"Id":74,"Name":"JohnK"},{"Id":87,"Name":"test"}],"Page":1,"total":1,"records":3}&#39;;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var rr = (eval("(" + r + ")"));<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; grid.addJSONData(rr);</p>
<p>I don&#39;t get it, am i missing files or am i adding them out of order? They get added in this order:</p>
<p>files.Add("/Content/Scripts/Shared/JqGrid/i18n/grid.locale-en.js");<br />files.Add("/Content/Scripts/Shared/JqGrid/jquery.jqGrid.settings.js"); <br />files.Add("/Content/Scripts/Shared/JqGrid/jquery.jqGrid_3-8-1.min.js");</p>
<p>And am using jquery 1.4.2</p>
]]></description>
        	        	<pubDate>Thu, 16 Dec 2010 00:38:51 +0200</pubDate>
        </item>
        <item>
        	<title>feto on Local Data Paging &#38; Sorting</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/local-data-paging-sorting#p21309</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/local-data-paging-sorting#p21309</guid>
        	        	<description><![CDATA[<p>And I guess the question really is why after the grid is displaying my data and the grid is datatype:local, why doesn&#39;t local paging and sorting just work? Why would attempting to page or sort make the data disappear from the grid?</p>
]]></description>
        	        	<pubDate>Wed, 15 Dec 2010 23:41:05 +0200</pubDate>
        </item>
        <item>
        	<title>feto on Local Data Paging &#38; Sorting</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/local-data-paging-sorting#p21308</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/local-data-paging-sorting#p21308</guid>
        	        	<description><![CDATA[<p>Correct on the RowNum: 0 and rowTotal: -1, rowNum was supposed to be 10 but i copied it wrong.</p>
</p>
<p>But the reason i didnt call back to the server from the grid definition itself is because, and i should have mentioned it before i am actually returning 4 grid result sets from the server in one call and i populate 4 different datatype local grids locally from one server call so my AJAX post really looks like this:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.ajax({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; url: dataUrl,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data: "{}",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dataType: "json",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; type: "POST",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; contentType: "application/json; charset=utf-8&#8243;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; success: function(jsondata, stat) { //jsondata is already in json object form not json string form, from the server<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (stat == "success") {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var grid1 = $("#Grid1")[0];</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var grid2 = $("#Grid2")[0];</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var grid3 = $("#Grid3")[0];</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var grid4 = $("#Grid4")[0];</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; grid1.addJSONData(jsondata[0]);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; grid2.addJSONData(jsondata[1]);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; grid3.addJSONData(jsondata[2]);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; grid4.addJSONData(jsondata[3]);<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>What you suggested works i set loadonce:true datatype:json after the post becomes datatype:local, paging/sorting works. BUT like i said i have 4 local grids that i want to populate with one call to the server/webservice. And i do populate them initially but when i page/sort the grid data disappears</p>
]]></description>
        	        	<pubDate>Wed, 15 Dec 2010 23:28:56 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on Local Data Paging &#38; Sorting</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/local-data-paging-sorting#p21307</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/local-data-paging-sorting#p21307</guid>
        	        	<description><![CDATA[<p>First of all you should not use parameters <strong>rowNum: 0</strong> and <strong>rowTotal: -1</strong>. It is better to set <strong>rowNum</strong> to one from the values from the <strong>rowList</strong> array.</p>
<p>Instead of usage of separate <strong>$.ajax</strong> call it is better to use</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4731' value='Select Code' data-codeid='sfcode4731' /></p>
<div class='sfcode' id='sfcode4731'>ajaxGridOptions: { contentType: &#39;application/json; charset=utf-8&#39; }<br />url: dataUrl,<br />mtype: &#39;POST&#39;,<br />datatype: &#39;json&#39;</div>
<p>If the returned data contain array of objects having properties <strong>Id</strong> and <strong>Name</strong>, then you should additionally include parameter</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1621' value='Select Code' data-codeid='sfcode1621' /></p>
<div class='sfcode' id='sfcode1621'>jsonReader: { repeatitems: false }</div>
<p>See <a href="http://stackoverflow.com/questions/3169408/jqgrid-setgridparam-datatypelocal/3170652#3170652" target="_blank">this</a>, <a href="http://stackoverflow.com/questions/2675625/setting-the-content-type-of-requests-performed-by-jquery-jqgrid/2678731#2678731" target="_blank">this</a> and <a href="http://stackoverflow.com/questions/2835957/jquery-with-asp-net-mvc-calling-ajax-enabled-web-service/2836817#2836817" target="_blank">this</a> answer for more informations and examples.</p>
<p>Best regards<br />Oleg&#160;</p>
]]></description>
        	        	<pubDate>Wed, 15 Dec 2010 22:08:57 +0200</pubDate>
        </item>
        <item>
        	<title>feto on Local Data Paging &#38; Sorting</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/local-data-paging-sorting#p21304</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/local-data-paging-sorting#p21304</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>So upgrading from 3.6 to 3.8 has caused several breaks. And I&#39;ve been pounding my head for 2 days trying to fix them.</p>
</p>
<p>1. addJSONData stopped displaying data in the grid, this was do to the stricter rules on json formatting - Finally FIXED</p>
<p>2. Now data is displaying in grid but when i go to change the page or sort on column the data disappears from the grid.</p>
</p>
<p>I first define the grid this way:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $("#Grid").jqGrid({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: &#39;local&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; height: 255,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; width: 400,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colNames: [&#39;Id&#39;, &#39;Name&#39;],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colModel: [{ name: &#39;Id&#39;, index: &#39;Id&#39;, align: &#39;center&#39;, width: 20, hidden: true, key: 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;Name&#39;, index: &#39;Name&#39;, align: &#39;center&#39;, width: 40}],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowNum: 0,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowTotal: -1,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //scroll: 1,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowList: [10, 20, 50],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; loadonce: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; gridview: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortname: &#39;Name&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortorder: "asc",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; caption: &#39;Managers NOT in Group&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pager: &#39;#Pager&#39;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; });</p>
</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; jQuery("#Grid").jqGrid(&#39;navGrid&#39;, &#39;#Pager&#39;, { del: false, add: false, edit: false, search: false, refresh: false });<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; jQuery("#Grid").jqGrid(&#39;filterToolbar&#39;, { stringResult: true, searchOnEnter: false });</p>
</p>
<p>then a seperate function is called via AJAX to populate the grid this way:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.ajax({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; url: dataUrl,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data: "{}",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dataType: "json",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; type: "POST",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; contentType: "application/json; charset=utf-8",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; success: function(jsondata, stat) { //jsondata is already in json object form not json string form, from the server<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (stat == "success") {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var grid = $("#Grid")[0];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; grid.addJSONData(jsondata);<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>
<p>Like I said initally the grid is populated with data corretly but when I try to do a page change or sort all data disappears from the grid and the pager changes its correct values (page 1 of 4 viewing 1-10 of 32) to (page 1 of NaN No Records) .</p>
</p>
<p>thx in advance</p>
]]></description>
        	        	<pubDate>Wed, 15 Dec 2010 19:48:09 +0200</pubDate>
        </item>
</channel>
</rss>