<?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: Extension points / plugin API</title>
	<link>http://www.trirand.com/blog/?page_id=393/discussion/extension-points-plugin-api</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/discussion/extension-points-plugin-api/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Craig Stuntz on Extension points / plugin API</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/extension-points-plugin-api#p17303</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/extension-points-plugin-api#p17303</guid>
        	        	<description><![CDATA[<blockquote>
<p>tony said:</p>
<p>Hello,</p>
<p>this is maybe what you looking for:</p>
<p>$.extend($.jgrid.defaults,{...});</p>
<p>before creating a grid <img class="spSmiley" style="margin:0" title="Wink" src="/blog/wp-content/forum-smileys/sf-wink.gif" alt="Wink" /></p>
<p>Regards</p>
<p>Tony</p>
</blockquote>
<hr />
<p>That doesn&#39;t fix the problem. If the grid user binds beforeRequest, then my code doesn&#39;t run. Existing plugins (e.g., treegrid, subgrid) require modification of grid.base.js. to work. That&#39;s bad; the grid should not depend on its plugins. What if I could do:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6320' value='Select Code' data-codeid='sfcode6320' /></p>
<div class='sfcode' id='sfcode6320'>$.jgrid.plugins.bind(&#34;beforeRequest.jqGrid&#34;, function() { myPluginCode(); });</div>
<p>(or other events). Then a plugin author could write a plugin which works without having to change grid.base.js for every plugin.</p>
]]></description>
        	        	<pubDate>Wed, 19 May 2010 16:49:51 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Extension points / plugin API</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/extension-points-plugin-api#p17220</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/extension-points-plugin-api#p17220</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>this is maybe what you looking for:</p>
<p>$.extend($.jgrid.defaults,{...});</p>
<p>before creating a grid <img class="spSmiley" style="margin:0" title="Wink" src="/blog/wp-content/forum-smileys/sf-wink.gif" alt="Wink" /></p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Mon, 17 May 2010 19:29:43 +0300</pubDate>
        </item>
        <item>
        	<title>Craig Stuntz on Extension points / plugin API</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/extension-points-plugin-api#p17219</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/extension-points-plugin-api#p17219</guid>
        	        	<description><![CDATA[<p>Tony,</p>
</p>
<p>Thanks for responding, but that doesn&#39;t answer my question. I will try to clarify.</p>
</p>
<p>I know that there is a beforeRequest event, but to handle it I need to change options to include a handler for beforeRequest. So a user of my plugin could write:</p>
<p style="padding-left: 30px;">$("#grid").jqGrid({ beforeRequest: function() { $.gridHistory(this) } });</p>
<p>...but that&#39;s an <em>incredibly </em>awkward way to use a "plugin", especially if the user is already hooking beforeRequest for something else.</p>
<p>I would prefer that the user could just write:</p>
<p style="padding-left: 30px;">$("#grid").jqGrid({ history: true });</p>
</p>
<p>What I&#39;m asking for, essentially, is a <em>global </em>beforeRequest handler (well, better still would be an event which ran once when the grid was created, not before every request -- but even a global beforeRequest is better than what I have now). One which always runs for all grids, not one specific grid. Like I said, it would go in the global $.jgrid rather than the grid-specific options object.</p>
</p>
<p>Does that make more sense?</p>
</p>
<p>Thanks,</p>
<p>-Craig</p>
]]></description>
        	        	<pubDate>Mon, 17 May 2010 19:13:33 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Extension points / plugin API</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/extension-points-plugin-api#p17180</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/extension-points-plugin-api#p17180</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>I&#39;m not sure if this will do the job for you but there is exactley such event called beforeRequest - which is raised exactley before the request.</p>
<p><a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events" rel="nofollow" target="_blank"><a href="http://www.trirand.com/jqgridw" rel="nofollow">http://www.trirand.com/jqgridw</a>.....iki:events</a></p>
</p>
<p>Also I think it is easy to do such things - if I understand right the problem:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3970' value='Select Code' data-codeid='sfcode3970' /></p>
<div class='sfcode' id='sfcode3970'>
<p>var gridoptions = { url : "...", rowNum : 10,...}</p>
<p>if(some condition) {</p>
<p>gridoptions.rowNum = 20;</p>
<p>}</p>
<p>$("#mygrid").jqGrid(gridoptions);</p>
</div>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 15 May 2010 13:52:58 +0300</pubDate>
        </item>
        <item>
        	<title>Craig Stuntz on Extension points / plugin API</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/extension-points-plugin-api#p17176</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/extension-points-plugin-api#p17176</guid>
        	        	<description><![CDATA[<p>I&#39;m working on a jqGrid/bbq extension to  integrate jqGrid paging with browser history. Works pretty well, but I don&#39;t like the design.</p>
<p>I wrote a jqGridWithHistory function that the user calls. This returns a grid with the history extension. So instead of calling:</p>
<p style="padding-left: 30px;">$("#foo").jqGrid(opts);</p>
<p>You call:</p>
<p style="padding-left: 30px;">$("#foo").jqGridWithHistory(opts);</p>
<p>Instead.</p>
<p>It would make more sense to me to make the history integration an option, e.g.:</p>
<p style="padding-left: 30px;">$("#foo").jqGrid({ url: url, history: true, ... });</p>
<p>But I can&#39;t find an extension point in the grid source code which would allow this.</p>
<p>Essentially, I need to fiddle with the options before the grid is loaded, so that I can modify page, rowNum, and the like, if need be, and hook gridComplete. $.jgrid.default won&#39;t work because it&#39;s overwritten by options.</p>
<p>What would be ideal for me is if I could (inside my plugin) do something like:</p>
<p style="padding-left: 30px;">$.jgrid.extend("beforeCreate", function() {</p>
<p style="padding-left: 30px;">&#160;&#160;&#160; // run plugin code</p>
<p style="padding-left: 30px;">});</p>
<p>Then inside the function I could look at the grid properties and modify them if need be, after they&#39;re set but before the grid data is fetched. Other plugins, of course, could do the same, and there would probably need to be many extension points.</p>
<p>Does anything like this already exist and I just missed it?</p>
<p>If not, consider this a feature request.</p>
<p>I&#39;ll share my plugin when I&#39;m happy with the quality.</p>
<p>-Craig</p>
]]></description>
        	        	<pubDate>Fri, 14 May 2010 21:48:39 +0300</pubDate>
        </item>
</channel>
</rss>