<?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: help: Subgrid JSON data not populated</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/help-subgrid-json-data-not-populated</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/help-subgrid-json-data-not-populated/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>jasm0007 on help: Subgrid JSON data not populated</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/help-subgrid-json-data-not-populated#p27969</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/help-subgrid-json-data-not-populated#p27969</guid>
        	        	<description><![CDATA[<p><strong><img class="spSmiley" style="margin:0" title="Cry" src="/blog/wp-content/forum-smileys/sf-cry.gif" alt="Cry" />Hi Guys,</strong></p>
<p><strong>My data is displayed for the main grid but <span style="text-decoration: underline;">not</span> the subgrid when i pass the information from the <em>controller</em> to the <em>view</em>. This is the json data response passed: </strong></p>
<div class="netInfoResponseText netInfoText ">
<pre><p><input type='button' class='sfcodeselect' name='sfselectit6738' value='Select Code' data-codeid='sfcode6738' /></p><div class='sfcode' id='sfcode6738'>{"records":"1","total":"1","page":"1","rows":[{"id":"1","cell":["cell11","cell12","cell13"]},{"id":"2"</div><p><input type='button' class='sfcodeselect' name='sfselectit4877' value='Select Code' data-codeid='sfcode4877' /></p><div class='sfcode' id='sfcode4877'>,"cell":["cell21","cell22","cell23"]}]}</div></pre>
<pre><p><input type='button' class='sfcodeselect' name='sfselectit8462' value='Select Code' data-codeid='sfcode8462' /></p><div class='sfcode' id='sfcode8462'></div>&#160;</pre>
<pre><p><input type='button' class='sfcodeselect' name='sfselectit6079' value='Select Code' data-codeid='sfcode6079' /></p><div class='sfcode' id='sfcode6079'><p><strong>Below are my <em>controller</em> and view <em>codes</em>.</strong></p></div></pre>
</div>
<p><strong>SubGridController.groovy</strong></p>
<p>import grails.converters.JSON</p>
<p>class SubGridController {</p>
<p>&#160;&#160;&#160; def index = { }<br />&#160;<br />&#160;def indexJSON = {<br />&#160;&#160;println "Entering indexJSON..."<br />&#160;&#160;<br />&#160;&#160;def formattedList = []<br />&#160;&#160;<br />&#160;&#160;def myGridData=[:]<br />&#160;&#160;myGridData.put("id", "1")<br />&#160;&#160;myGridData.put("cell",["cell11", "cell12", "cell13"])<br />&#160;&#160;<br />&#160;&#160;myGridData=[:]<br />&#160;&#160;myGridData.put("id", "2")<br />&#160;&#160;myGridData.put("cell",["cell21", "cell22", "cell23"])<br />&#160;&#160;formattedList &#60;&#60; myGridData&#160;&#160;</p>
<p>&#160;&#160;println &#39;formatted list =&#62; &#39;+formattedList<br />&#160;&#160; <br />&#160;&#160;def data = [records: &#39;1&#39;, total: &#39;1&#39;, page: &#39;1&#39;, rows: formattedList]<br />&#160;&#160;println &#39;data =&#62; &#39; + data<br />&#160;&#160;<br />&#160;&#160;render data as JSON<br />&#160;&#160;<br />&#160;&#160;println "Exiting indexJSON..."<br />&#160;}<br />}</p>
</p>
<p><strong>index.gsp</strong></p>
<p>&#60;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&#62;<br />&#60;html xmlns="http://www.w3.org/1999/xhtml" /&#62;<br />&#160;&#160;&#160; &#60;link rel="stylesheet" type="text/css" href="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.3.1/css/ui.jqgrid.css" /&#62;<br />&#160;&#160;&#160; &#60;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js%22%3E%3C/script"&#62;&#60;/script&#62;<br />&#160;&#160;&#160; &#60;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js%22%3E%3C/script"&#62;&#60;/script&#62;<br />&#160;&#160;&#160; &#60;script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.3.1/js/i18n/grid.locale-en.js%22%3E%3C/script"&#62;&#60;/script&#62;<br />&#160;&#160;&#160; &#60;script type="text/javascript"&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.jgrid.no_legacy_api = true;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.jgrid.useJSON = true;<br />&#160;&#160;&#160; &#60;/script&#62;<br />&#160;&#160;&#160; &#60;script type="text/javascript" src="http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.3.1/js/jquery.jqGrid.src.js%22%3E%3C/script"&#62;&#60;/script&#62;</p>
<p>&#60;script type="text/javascript"&#62;<br />&#160;&#160;&#160; //&#60;![CDATA[<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*global $ */<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*jslint browser: true */<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; jQuery(document).ready(function() {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; jQuery(document).bind("contextmenu",function(e){<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return false;<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160; });<br />&#160;&#160;&#160; &#160;&#160;jQuery(document).select(function(){<br />&#160;&#160;&#160; &#160;&#160;&#160;return false<br />&#160;&#160;&#160; &#160;&#160;});</p>
<p>&#160;&#160;&#160; &#160;&#160;jQuery("#customerDialerTable").jqGrid({<br />&#160;&#160;&#160; &#160;&#160;&#160;<a href="/blog/%22$%7BcreateLink(controller:&#39;subGrid&#39;" target="_blank">url:"${createLink(controller:&#39;subGrid&#39;</a>, action:&#39;indexJSON&#39;)}",<br />&#160;&#160;&#160; &#160;&#160;&#160;jsonReader:{<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160;root: "rows",<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160;page: "page",<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160;total: "total",<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160;records: "records",<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160;repeatitems:true,<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160;cell: "cell", <br />&#160;&#160;&#160; &#160;&#160;&#160;&#160;id:"id",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;subgrid: {root:"rows", <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; repeatitems: true, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cell:"cell"<br />&#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;},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: &#39;json&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colNames: [&#39;ID&#39;, &#39;Column 1&#39;],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colModel: [<br />&#160;&#160;&#160;&#160;{name:&#39;id&#39;, index:&#39;id&#39;, align:&#39;center&#39;, jsonmap:&#39;id&#39;, sortable:true,width:&#39;30%&#39;},&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;{name:&#39;col1&#39;, index:&#39;col1&#39;, align:&#39;center&#39;, jsonmap:&#39;cell&#39;, sortable:true,width:&#39;30%&#39;}<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;&#160;&#160;&#160;&#160; align:&#39;center&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortname: &#39;id&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortorder: &#39;desc&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; height: &#39;auto&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; autowidth:true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pager: &#39;#customerDialerPage&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; caption:&#39;Testing&#39;,</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; scroll: false,<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;scrollOffset:&#39;0&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;rowNum:8,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;rowList:[8,20,50],<br />&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; viewrecords: true,&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; subGrid: 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; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; subGridModel : <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;&#160;&#160;&#160; { <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;&#160;&#160;&#160; name&#160; : [&#39;No&#39;, &#39;Item&#39;]<br />&#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;&#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;});<br />&#160;&#60;/script&#62;<br />&#60;/head&#62;</p>
<p>&#60;body&#62;<br />&#160;&#60;div class="box" style="text-align: center;"&#62;<br />&#160;&#160;&#60;br /&#62; &#60;br /&#62;<br />&#160;&#160;&#60;div id="table"&#62;<br />&#160;&#160;&#160;&#60;table id="customerDialerTable"&#62;&#60;/table&#62;<br />&#160;&#160;&#160;&#60;div id="customerDialerPage"&#62;&#60;/div&#62;<br />&#160;&#160;&#60;/div&#62;<br />&#160;&#160;&#60;!-- div id="table" --&#62;<br />&#160;&#160;&#60;br /&#62;<br />&#160;&#60;/div&#62;<br />&#160;&#60;!-- div id="box" --&#62;<br />&#160;&#60;div id="progressDialog" title="Loading..."&#62;<br />&#160;&#160;&#60;p&#62;Please Wait..&#60;/p&#62;<br />&#160;&#160;&#60;div id="progressBar"&#62;&#60;/div&#62;<br />&#160;&#160;&#60;!-- div id="progressDialog" --&#62;<br />&#160;&#60;/div&#62;<br />&#60;/body&#62;<br />&#60;/html&#62;</p>
<p><strong>Thanks all for the help as i&#39;m rather new to jquery/jqgrid 🙂</strong></p>
]]></description>
        	        	<pubDate>Wed, 02 Jan 2013 04:36:45 +0200</pubDate>
        </item>
</channel>
</rss>