<?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: Get total rows before grid is rendered</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/get-total-rows-before-grid-is-rendered</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/get-total-rows-before-grid-is-rendered/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>RustedBucket on Get total rows before grid is rendered</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/get-total-rows-before-grid-is-rendered#p25411</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/get-total-rows-before-grid-is-rendered#p25411</guid>
        	        	<description><![CDATA[<p>Ok think I got it figured out&#8230; Here&#39;s the modified code of the above&#8230;</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5640' value='Select Code' data-codeid='sfcode5640' /></p>
<div class='sfcode' id='sfcode5640'>
<p>&#160;&#160;&#160; $.ajax({<br />&#160;&#160; &#160;&#160;&#160;&#160; type: &#34;POST&#34;,<br />&#160;&#160; &#160;&#160;&#160;&#160; url: &#34;/air/purchases/detailgrid/ponum/&#34; + postData,<br />&#160;&#160; &#160;&#160;&#160;&#160; datatype: &#34;json&#34;,<br />&#160;&#160; &#160;&#160;&#160;&#160; success: function (data, status) {<br />&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <strong>var tdata = JSON.stringify(data);</strong><br />&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var trows = data.records;<br />&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; renderGrid(trows, tdata);<br />&#160;&#160; &#160;&#160;&#160;&#160; }<br />&#160;&#160; &#160;});<br />&#160;&#160; &#160;<br />&#160;&#160; &#160;function renderGrid(trows, tdata) {</p>
<p>&#160;&#160; &#160;&#160;&#160;&#160; jQuery(&#34;#purchases&#34;).jqGrid({<br />&#160;&#160; &#160;<br /><strong>&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: &#34;jsonstring&#34;,<br />&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; datastr: tdata,</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8230;</p>
</p>
</div>
<p>Basically needed to convert the JSON object to a string and pass the whole thing to the grid, then tell the grid to use a JSON string. Works like a champ now.</p>
]]></description>
        	        	<pubDate>Wed, 14 Dec 2011 16:23:56 +0200</pubDate>
        </item>
        <item>
        	<title>RustedBucket on Get total rows before grid is rendered</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/get-total-rows-before-grid-is-rendered#p25402</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/get-total-rows-before-grid-is-rendered#p25402</guid>
        	        	<description><![CDATA[<p>Tony, ok I got it sort of figured. Here&#39;s my code.</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9999' value='Select Code' data-codeid='sfcode9999' /></p>
<div class='sfcode' id='sfcode9999'>
<p>$.ajax({<br />&#160;&#160;&#160; type: "POST",<br />&#160;&#160;&#160; url: "/air/purchases/detailgrid/ponum/" + postData,<br />&#160;&#160;&#160; datatype: "json",<br />&#160;&#160;&#160; success: function (data, status) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var tdata = data.rows;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var trows = data.records;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; renderGrid(trows, tdata);<br />&#160;&#160;&#160; }</p>
<p>});</p>
<p>function renderGrid(trows, tdata) {<br />&#160;&#160; &#160;jQuery("#purchases").jqGrid({</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: "local",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; data: tdata,<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;height:theight,<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;colNames:[&#39;Item&#39;, &#39;UPC&#39;, &#39;Description&#39;, &#39;Order Qty.&#39;, &#39;Est. Cost&#39;, &#39;Shipped Qty.&#39;, &#39;Billed Cost&#39;],<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;colModel:[<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;item_number&#39;,index:&#39;item_number&#39;, width:20, align:"center"},<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;upc&#39;,index:&#39;upc&#39;, width:20, align:"center"},<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;description&#39;,index:&#39;description&#39;, width:55},<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;order_quantity&#39;,index:&#39;order_quantity&#39;, width:15, align:"center",formatter: &#39;integer&#39;, formatoptions:{thousandsSeparator: ",", defaultValue: &#39;0&#39;}},<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;order_unit_cost&#39;,index:&#39;order_unit_cost&#39;, width:15, align:"center",formatter: &#39;currency&#39;, formatoptions:{decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, prefix: "$ "}},<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;shipped_quantity&#39;,index:&#39;shipped_quantity&#39;, width:15, align:"center",formatter: &#39;integer&#39;, formatoptions:{thousandsSeparator: ",", defaultValue: &#39;0&#39;}},<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;{name:&#39;shipped_unit_cost&#39;,index:&#39;shipped_unit_cost&#39;, width:15, align:"center",formatter: &#39;currency&#39;, formatoptions:{decimalSeparator:".", thousandsSeparator: ",", decimalPlaces: 2, prefix: "$ "}}<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;],<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;rowNum: trows,<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;rownumbers: true, <br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;rownumWidth: 40,&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;pager: &#39;#pager&#39;,<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;altRows: true,<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;altclass:&#39;myAltRowClass&#39;,<br />&#160;&#160; &#160;&#160; &#160;&#160;&#160; &#160;gridview: true,<br />&#160;&#160; &#160;&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160; &#160;&#160;&#160;&#160; footerrow: true, <br />&#160;&#160; &#160;&#160;&#160;&#160; userDataOnFooter: true,&#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160;&#160; sortorder: "asc",<br />&#160;&#160; &#160;&#160;&#160;&#160; autowidth: true,<br />&#160;&#160; &#160;&#160;&#160;&#160; shrinkToFit: true&#160; &#160;<br />&#160;&#160; &#160;<br />&#160;&#160; &#160;});<br />}</p>
</div>
<p>The problem now is, the grid display with the correct number of rows, and the JSON data is there in Firebug but all the rows are empty. Any ideas what I&#39;m doing wrong?Thanks</p>
]]></description>
        	        	<pubDate>Wed, 14 Dec 2011 03:39:35 +0200</pubDate>
        </item>
        <item>
        	<title>RustedBucket on Get total rows before grid is rendered</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/get-total-rows-before-grid-is-rendered#p25399</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/get-total-rows-before-grid-is-rendered#p25399</guid>
        	        	<description><![CDATA[<p>Figured out the beforeProcessing issue. Wasn&#39;t using the latest 4.3 version of the grid which contained the beforeProcessing functions.</p>
</p>
<p>I thought this might work but it doesn&#39;t.</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1335' value='Select Code' data-codeid='sfcode1335' /></p>
<div class='sfcode' id='sfcode1335'>
<p>&#160;&#160;&#160; beforeProcessing: function(t,data, status, xhr) {<br />&#160;&#160; &#160;&#160;&#160; &#160;jQuery.extend(jQuery.jgrid.defaults, { rowNum:t.records });<br />&#160;&#160; &#160;},&#160;&#160;&#160;</p>
</p>
</div>
]]></description>
        	        	<pubDate>Tue, 13 Dec 2011 19:38:17 +0200</pubDate>
        </item>
        <item>
        	<title>RustedBucket on Get total rows before grid is rendered</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/get-total-rows-before-grid-is-rendered#p25398</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/get-total-rows-before-grid-is-rendered#p25398</guid>
        	        	<description><![CDATA[<p>Mostly because everything I&#39;ve tried so far hasn&#39;t worked.<strong> You mind giving an example. </strong></p>
<p>I would have assumed according to the doc that beforeProcessing would be a trigger point to do this, but that seems to do nothing at all.</p>
<p>I&#39;d prefer not to call the query a second time just to get something that&#39;s already being returned to the grid, I just can&#39;t seem to figure out where/how to read it.</p>
]]></description>
        	        	<pubDate>Tue, 13 Dec 2011 18:09:24 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Get total rows before grid is rendered</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/get-total-rows-before-grid-is-rendered#p25380</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/get-total-rows-before-grid-is-rendered#p25380</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>I wonder why do you try to resolve everthing with the grid methods. You should have a very simple solution.</p>
<p>Create your own ajax call - this call should ask for the number of recordes (separate one)</p>
<p>In the succes of this ajax call construct your grid with the rowNum obtained from the request.</p>
</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 13 Dec 2011 09:27:39 +0200</pubDate>
        </item>
        <item>
        	<title>RustedBucket on Get total rows before grid is rendered</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/get-total-rows-before-grid-is-rendered#p25374</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/get-total-rows-before-grid-is-rendered#p25374</guid>
        	        	<description><![CDATA[<p>Is there a way to get the total rows and set rowNum before the grid is  actually rendered? Picking an arbitrary number like 100 is fine for  queries returning less than 100 records, but once those go over the rowNum limit no more records are displayed (without paging or dynamic scrolling etc).</p>
</p>
<p>The JSON response contains the total number of records contained in the results set, is there a way to read this and use that value to set rowNum so the grid can always display the total number of records without hitting a hard limit?</p>
]]></description>
        	        	<pubDate>Mon, 12 Dec 2011 23:19:15 +0200</pubDate>
        </item>
</channel>
</rss>