<?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: Programmatically loading Grid with addJSONData</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/programmatically-loading-grid-with-addjsondata</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/programmatically-loading-grid-with-addjsondata/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Programmatically loading Grid with addJSONData</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/programmatically-loading-grid-with-addjsondata#p10784</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/programmatically-loading-grid-with-addjsondata#p10784</guid>
        	        	<description><![CDATA[<p>Hello Rick,</p>
<p>Could you please try with this:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7926' value='Select Code' data-codeid='sfcode7926' /></p>
<div class='sfcode' id='sfcode7926'>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Proxy.GetCustomerList(function(custList) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; alert(custList); // object is in right format&#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;&#160;&#160;&#160;&#160; gdCustomers[0].addJSONData(custList);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; });</p>
</div>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 17 Oct 2009 06:42:45 +0300</pubDate>
        </item>
        <item>
        	<title>Rick Strahl on Programmatically loading Grid with addJSONData</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/programmatically-loading-grid-with-addjsondata#p10767</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/programmatically-loading-grid-with-addjsondata#p10767</guid>
        	        	<description><![CDATA[<p>Hi,</p>
</p>
<p>I&#39;m trying to get a jqGrid to update programmatically with JSON retrieved data, but not having much luck.</p>
<p>I can get data to load fine if I choose datatype: "json" - this works and the grid displays as it should. However, if I manually load the data from the same URL and decode the JSON into an object, with the following:</p>
</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; gdCustomers.jqGrid({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; url: "jqGrid.aspx?CallbackTarget=Proxy&#38;Method=GetCustomerList",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; editurl: "jqGrid.aspx?CallbackTarget=Proxy&#38;Method=UpdateCustomerRow",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: "clientside",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colNames: ["Name", "Company", "Entered"],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colModel: [<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;&#160; { name: "Name", index: "Name", width: 150, editable: true, edittype: "text" },<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;&#160; { name: "CompanyName", index: "CompanyName", width: 200, editable: 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;&#160; { name: "Entered", index: "Entered", width: 75, editable: true, datefmt: "MM/dd/yyyy" }<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;&#160; ],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortname: "Company",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowNum: 14,<br />&#160;&#160;&#160;&#160;&#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;&#160;&#160;&#160;&#160; sortorder: "asc",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; caption: "Northwind Customer List",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; width: 800,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; height: 308,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pager: "#gdCustomersPager",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ondblClickRow: function(id) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; gdCustomers.restoreRow(lastSel);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; gdCustomers.editRow(id, true);<br />&#160;&#160;&#160;&#160;&#160;&#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;&#160;&#160; }).navGrid("#gdCustomersPager");</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Proxy.GetCustomerList(function(custList) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; alert(custList); // object is in right format&#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;&#160;&#160;&#160;&#160; gdCustomers.addJSONData(custList);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; });</p>
</p>
<p>Specifically the problem is that addJSONData(custList) in this case doesn&#39;t do anything. No error, no message but the grid also doesn&#39;t receive the data.custData isn&#39;t JSON but it&#39;s an object, but according to the sample in the docs this is what is expected here I think (ie. an object instance rather than a JSON string - the name of the method is rather inaccurate if it&#39;s the former).</p>
<p>The only way I can get the data in under program control is by looping through the rows manually and then explicitly using addRowData.</p>
<p>While the latter works i can&#39;t seem to provide the necessary paging information (total pages, and total record count) to the grid so paging doesn&#39;t work properly.</p>
<p>How do I get jqGrid to load under program control using the same data that the direct JSON link uses?</p>
<p>TIA,</p>
<p>+++ Rick ---</p>
]]></description>
        	        	<pubDate>Fri, 16 Oct 2009 07:30:57 +0300</pubDate>
        </item>
</channel>
</rss>