<?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: jqGrid not showing my data?</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-not-showing-my-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/jqgrid-not-showing-my-data/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Alghamdi on jqGrid not showing my data?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-not-showing-my-data#p29837</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/jqgrid-not-showing-my-data#p29837</guid>
        	        	<description><![CDATA[<p>My API "/api/v1/users" returns this:</p>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit5023' value='Select Code' data-codeid='sfcode5023' /></p><div class='sfcode' id='sfcode5023'>[
  {
    &#34;email&#34;: &#34;ww@ww.com&#34;,
    &#34;name&#34;: &#34;ww&#34;,
    &#34;password&#34;: &#34;qLfsebHMKv7dNgExtR&#34;,
    &#34;active&#34;: false,
    &#34;role&#34;: &#34;admin&#34;,
    &#34;createdAt&#34;: &#34;2013-10-22T11:48:32.719Z&#34;,
    &#34;updatedAt&#34;: &#34;2013-10-22T11:48:32.719Z&#34;,
    &#34;id&#34;: &#34;52666610a6a311308b000001&#34;
  },
  {
    &#34;email&#34;: &#34;qq@qq.com&#34;,
    &#34;name&#34;: &#34;QQ&#34;,
    &#34;password&#34;: &#34;twfubGHoQkYDVup&#34;,
    &#34;active&#34;: true,
    &#34;role&#34;: &#34;expert&#34;,
    &#34;createdAt&#34;: &#34;2013-10-22T11:38:47.578Z&#34;,
    &#34;updatedAt&#34;: &#34;2013-10-22T11:38:47.578Z&#34;,
    &#34;id&#34;: &#34;526663c788101c9f89000001&#34;
  }
]</div></pre>
</p>
<p>and this is my js:</p>
<pre class="default prettyprint prettyprinted"><p><input type='button' class='sfcodeselect' name='sfselectit9063' value='Select Code' data-codeid='sfcode9063' /></p><div class='sfcode' id='sfcode9063'>$(function () {
    $(&#39;#list&#39;).jqGrid({
      url: &#39;/api/v1/users&#39;,
      datatype: &#39;json&#39;,
      mtype: &#39;GET&#39;,
      colNames: [&#39;id&#39;,&#39;email&#39;,&#39;name&#39;, &#39;password&#39;, &#39;active&#39;,&#39;role&#39;,&#39;createdAt&#39;,&#39;updatedAt&#39;],
      colModel: [
      { name: &#39;id&#39;, width: 80 },
      { name: &#39;email&#39;, width: 80 },
      { name: &#39;name&#39;, width: 80, align: &#39;right&#39; },
      { name: &#39;password&#39;, width: 80, align: &#39;right&#39; },
      { name: &#39;active&#39;, width: 80, align: &#39;right&#39; },
      { name: &#39;role&#39;, width: 80, align: &#39;right&#39; },
      { name: &#39;createdAt&#39;, width: 80, align: &#39;right&#39; },
      { name: &#39;updatedAt&#39;, width: 80, sortable: false }
      ],
      pager: &#39;#pager&#39;,
      rowNum: 10,
      rowList: [10, 20, 30],
      viewrecords: true,
      gridview: true,
      autoencode: true,
      caption: &#39;My first grid&#39;,
    }); 
  }); </div></pre>
</p>
<p>I could not get that to work at all.</p>
<p>I added:&#160;</p>
<div id="post-editor" class="post-editor">
<div id="wmd-preview" class="wmd-preview">
<pre><p><input type='button' class='sfcodeselect' name='sfselectit6460' value='Select Code' data-codeid='sfcode6460' /></p><div class='sfcode' id='sfcode6460'>  loadComplete: function (data) {
    console.log(&#34;OK&#34;);
    console.log(data);
  },
  loadError: function (jqXHR, textStatus, errorThrown) {
    console.log(&#39;HTTP status code: &#39; + jqXHR.status + &#39;n&#39; +
    &#39;textStatus: &#39; + textStatus + &#39;n&#39; +
    &#39;errorThrown: &#39; + errorThrown);
    console.log(&#39;HTTP message body (jqXHR.responseText): &#39; + &#39;n&#39; + jqXHR.responseText);
  }
</div></pre>
</div>
</div>
<p><em><span style="color: #808080;">loadComplete</span></em> always returns <span style="color: #808080;"><em>OK</em></span>, however, <em><span style="color: #808080;">data</span></em>&#160;is an empty array <span style="color: #808080;"><em>[].</em></span>&#160;What am I missing here?</p>
</p>
<p><strong>Update 1:</strong></p>
<p>I inspected&#160;the request jqGrid sends and it apear it appends this to my API:&#160;</p>
<p class="p1">&#160;</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3961' value='Select Code' data-codeid='sfcode3961' /></p>
<div class='sfcode' id='sfcode3961'>/api/v1/users?_search=false&#38;nd=1384254700817&#38;rows=20&#38;page=1&#38;sidx=&#38;sord=asc</div>
<p class="p1">When I hit this url it does return that empaty array. Any idea how to change this behaviour?&#160;</p>
]]></description>
        	        	<pubDate>Tue, 12 Nov 2013 13:01:34 +0200</pubDate>
        </item>
</channel>
</rss>