<?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: loadonce question</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/loadonce-question</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/loadonce-question/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>JeffV on loadonce question</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/loadonce-question#p18380</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/loadonce-question#p18380</guid>
        	        	<description><![CDATA[<p>If I load the grid with 400+ records, I&#39;m trying to figure out a way to not have to hit the server everytime I go to the next page.&#160; It is my understanding that if I set loadonce:true then that should do the trick.&#160; However, everytime I change the page I see the webservice being called.</p>
</p>
<p>Is my understanding of this functionality wrong?&#160;&#160;&#160; My code is below.</p>
</p>
<p>jQuery(document).ready(function () {<br />&#160;&#160;&#160; jQuery("#list").jqGrid({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: processrequest,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; mtype: &#39;POST&#39;, &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; jsonReader: { &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; repeatitems: false, &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; id: "name" //index of the column with the PK in it&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; colNames: [&#39;Name&#39;, &#39;Title&#39;],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; colModel: [<br />&#160;&#160;&#160;&#160;&#160; { name: &#39;name&#39;, index: &#39;name&#39;, width: 250 },<br />&#160;&#160;&#160;&#160;&#160; { name: &#39;title&#39;, index: &#39;title&#39;, width: 250 }<br />&#160;&#160;&#160;&#160;&#160; ],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; pager: &#39;#pager&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowNum: 10,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowList: [10, 20, 30],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortorder: "desc",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; height: &#39;250px&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; caption: &#39;My first grid&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <strong>loadonce: true</strong><br />&#160;&#160;&#160; }).navGrid(&#39;#pager&#39;, {edit: false, add: false, del: false});<br />});</p>
<p>function processrequest(postdata) {<br />&#160;&#160;&#160; $(".loading").show();<br />&#160;&#160;&#160; $.ajax({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; type: "POST",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; data: "{}",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: "json",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; url: "../webServices/myTestWS.asmx/testMethod",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; contentType: "application/json; charset-utf-8",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; complete: function (jsondata, stat) {<br />&#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; var thegrid = jQuery("#list")[0];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var jsonObject = (eval("(" + jsondata.responseText + ")"));<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; thegrid.addJSONData(jsonObject.d);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(".loading").hide();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } else {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(".loading").hide();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; alert("Error with AJAX callback");<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160; });<br />}</p>
]]></description>
        	        	<pubDate>Sat, 03 Jul 2010 18:40:17 +0300</pubDate>
        </item>
</channel>
</rss>