<?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: small improvment of the performance of working with jqGrid methods</title>
	<link>http://www.trirand.com/blog/?page_id=393/feature-request/small-improvment-of-the-performance-of-working-with-jqgrid-methods</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/feature-request/small-improvment-of-the-performance-of-working-with-jqgrid-methods/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on small improvment of the performance of working with jqGrid methods</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/small-improvment-of-the-performance-of-working-with-jqgrid-methods#p27966</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/small-improvment-of-the-performance-of-working-with-jqgrid-methods#p27966</guid>
        	        	<description><![CDATA[<p>Hello Oleg,</p>
<p>I have implemented your idea, extended to grouping too (code is in GitHub). Also i do not think that we need the code when the pin=undefined.</p>
<p>We can easy do (after the grid is created)</p>
</p>
<p>var $gird = $("#grid") and then use use it&#160; or</p>
<p>var $gird = $("#grid").jqGrid({&#8230;}) when it is created.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 28 Dec 2012 12:46:13 +0200</pubDate>
        </item>
        <item>
        	<title>tony on small improvment of the performance of working with jqGrid methods</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/small-improvment-of-the-performance-of-working-with-jqgrid-methods#p27884</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/small-improvment-of-the-performance-of-working-with-jqgrid-methods#p27884</guid>
        	        	<description><![CDATA[<p>Oleg,</p>
<p>This is very interesting. Will perform tests in order to get feedback.</p>
</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Mon, 10 Dec 2012 12:27:08 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on small improvment of the performance of working with jqGrid methods</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/small-improvment-of-the-performance-of-working-with-jqgrid-methods#p27881</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/small-improvment-of-the-performance-of-working-with-jqgrid-methods#p27881</guid>
        	        	<description><![CDATA[<p>Hello Tony,</p>
<p>the code of jqGrid uses internally <strong>$.jgrid.no_legacy_api=true</strong> style of wotking with methods. It menas that one find everywhere in the code the calls like</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3284' value='Select Code' data-codeid='sfcode3284' /></p>
<div class='sfcode' id='sfcode3284'>$(ts).jqGrid(&#34;addSubGridCell&#34;,...)</div>
<p>see <a href="https://github.com/OlegKi/jqGrid/blob/v4.4.1/js/grid.base.js#L1383" target="_blank">the line</a> of code for example. Even if such calles will be done inside of loops the current style of accessing to jqGrid methods not allows to save one the functions <strong>addSubGridCell</strong> in a variable and call it directly inside of the loop&#39;s body.</p>
<p>I suggest to introduce very simple method getMethod</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2875' value='Select Code' data-codeid='sfcode2875' /></p>
<div class='sfcode' id='sfcode2875'>$.extend($.jgrid, {<br />&#160; &#160; getMethod: function (name) {<br />&#160; &#160; &#160; &#160; return $.jgrid.getAccessor($.fn.jqGrid, name);<br />&#160; &#160; }<br />});&#160;</div>
<p>which get the reference to the method of jqGrid by string parameter (if needed one can include additional test whether the type of parameter is really string). If the method is not exist the method return <strong>undefined</strong> value.</p>
<p>Using the method one can rewrite above call of addSubGridCell in two parts. In the fisrt one at the beginning on the function (at the beginning of <strong>addJSONData</strong> function in the example) or directly before the loop one can use</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9814' value='Select Code' data-codeid='sfcode9814' /></p>
<div class='sfcode' id='sfcode9814'>var $self = $(ts),<br />&#160; &#160; addSubGridCell = $.jgrid.getMethod(&#34;addSubGridCell&#34;);</div>
<p>to save the needed expressions in variables and then use</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4979' value='Select Code' data-codeid='sfcode4979' /></p>
<div class='sfcode' id='sfcode4979'>addSubGridCell.call($self,...)</div>
<p>instead of</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4370' value='Select Code' data-codeid='sfcode4370' /></p>
<div class='sfcode' id='sfcode4370'>$(ts).jqGrid(&#34;addSubGridCell&#34;,...)</div>
<p>The code will stay readable, but the performance will be improved.</p>
<p>Additionally one can add explicit test for <strong>undefined</strong> parameter (call without parameters) in <a href="https://github.com/OlegKi/jqGrid/blob/v4.4.1/js/grid.base.js#L644-L654" target="_blank">the part</a> of code:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7422' value='Select Code' data-codeid='sfcode7422' /></p>
<div class='sfcode' id='sfcode7422'>$.fn.jqGrid = function( pin ) {<br />&#160; &#160; if (typeof pin ==<strong>=</strong> &#39;string&#39;) {<br />&#160; &#160; &#160; &#160; <strong>//var fn = $.fn.jqGrid[pin];</strong><br />&#160; &#160; &#160; &#160; <strong>var fn = $.jgrid.getMethod(pin);</strong><br />&#160; &#160; &#160; &#160; if (!fn) {<br />&#160; &#160; &#160; &#160; &#160; &#160; throw (&#34;jqGrid - No such method: &#34; + pin);<br />&#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; var args =&#160;$.makeArray(arguments).slice(1);<br />&#160; &#160; &#160; &#160; return fn.apply(this,args);<br />&#160; &#160; }<br />&#160; &#160; <strong>if (pin === undefined) {<br />&#160; &#160; &#160; &#160; // allow the usage of jqGrid methods in the form $(&#34;#list&#34;).jqGrid().method(params)<br />&#160; &#160; &#160; &#160; // for example<br />&#160; &#160; &#160; &#160; // &#160; &#160;$(&#34;#list&#34;).jqGrid().getGridParam(&#34;colModel&#34;)<br />&#160; &#160; &#160; &#160; // So one can save $(&#34;#list&#34;).jqGrid() in a variable<br />&#160; &#160; &#160; &#160; // &#160; &#160;var $self = $(&#34;#list&#34;).jqGrid();<br />&#160; &#160; &#160; &#160; // and one can use simplified form of method calls,<br />&#160; &#160; &#160; &#160; // exactly like in case of <em>no_legacy_api=false</em>:<br />&#160; &#160; &#160; &#160; // &#160; &#160;var localRowData = $self.getLocalRow(rowid);<br />&#160; &#160; &#160; &#160; return $.extend({}, this, $.fn.jqGrid);<br />&#160; &#160; }</strong><br />&#160; &#160; return this.each( function() {<br />&#160; &#160; &#160; &#160; ...&#160;</div>
<p>Best regards</p>
<p>Oleg</p></p>
]]></description>
        	        	<pubDate>Sun, 09 Dec 2012 20:58:29 +0200</pubDate>
        </item>
</channel>
</rss>