<?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: support dataUrl as function</title>
	<link>http://www.trirand.com/blog/?page_id=393/feature-request/support-dataurl-as-function</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/support-dataurl-as-function/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on support dataUrl as function</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/support-dataurl-as-function#p28728</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/support-dataurl-as-function#p28728</guid>
        	        	<description><![CDATA[<p>Hello Oleg,</p>
</p>
<p>Thanks. I will try to implement this later.</p>
</p>
<p>Kind Regards</p>
]]></description>
        	        	<pubDate>Mon, 29 Apr 2013 11:48:40 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on support dataUrl as function</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/support-dataurl-as-function#p28725</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/support-dataurl-as-function#p28725</guid>
        	        	<description><![CDATA[<p>Hello Tony,</p>
<p>there are exist more and more public services which supports RESTful API. For example <a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj710108.aspx" target="_blank">Windows Azure Mobile Services REST API</a> an example. The exsiting services can require to use rowid <strong><em>as the part of URL</em></strong> (see here and <a href="http://msdn.microsoft.com/en-us/library/windowsazure/jj677198.aspx" target="_blank">here</a> for example). The current implementation of Save button of <strong>inlineNav</strong> or the implementation&#160;<strong>dataUrl</strong>&#160;of still don&#39;t allow to modify the URL by appending <strong>"/" + encodeURIComponent(rowid)</strong>. The feature <strong>postData</strong> as function allows to post rowid, but not as the part of URL.</p>
<p>The most simple and flexible change in jqGrid code seems to me still to allow usage of function as the value of url (or surl, dataUrl). If one just change <a href="https://github.com/tonytomov/jqGrid/blob/v4.4.5/js/grid.common.js#L351" target="_blank">the line</a></p>
<p><input type='button' class='sfcodeselect' name='sfselectit1379' value='Select Code' data-codeid='sfcode1379' /></p>
<div class='sfcode' id='sfcode1379'>url: options.dataUrl,</div>
<p>in the same way as <a href="https://github.com/tonytomov/jqGrid/blob/v4.4.5/js/grid.common.js#L354" target="_blank">the line</a> with <strong>data</strong> option</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7386' value='Select Code' data-codeid='sfcode7386' /></p>
<div class='sfcode' id='sfcode7386'>data: $.isFunction(postData) ? postData.call($t, rowid, vl, String(options.name)) : postData,</div>
<p>it will get the most flexibility. I mean the code like</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6024' value='Select Code' data-codeid='sfcode6024' /></p>
<div class='sfcode' id='sfcode6024'>url: $.isFunction(options.dataUrl) ?<br />&#160; &#160; &#160; &#160; &#160;options.dataUrl.call($t, rowid, vl, String(options.name))&#160;:<br />&#160; &#160; &#160; &#160; &#160;options.dataUrl,</div>
<p>The same changes one could do in other parts of jqGrid where jQuery.ajax are used. The most important place seems for me <strong>saveRow</strong>, bacause there are no way to modify url dynamically especially in case of usage "Save" button of <strong>inlineNav</strong>.</p>
<p>Simple modification of <a href="https://github.com/tonytomov/jqGrid/blob/v4.4.5/js/grid.inlinedit.js#L295" target="_blank">the line</a>&#160;</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9738' value='Select Code' data-codeid='sfcode9738' /></p>
<div class='sfcode' id='sfcode9738'>url:o.url,</div>
<p>to something like</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6201' value='Select Code' data-codeid='sfcode6201' /></p>
<div class='sfcode' id='sfcode6201'>url: $.isFunction(o.url) ? o.url.call($t, rowid, tmp3)&#160;:&#160;o.url,</div>
<p><span style="font-size: 14px;">will give developer full flexibility to generate URL dynamically.</span></p>
<p>Best regards<br />Oleg</p></p>
]]></description>
        	        	<pubDate>Sat, 27 Apr 2013 14:32:40 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on support dataUrl as function</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/support-dataurl-as-function#p27702</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/support-dataurl-as-function#p27702</guid>
        	        	<description><![CDATA[<p>Hello Tony,</p>
<p>I read frequently the requirement to use <strong>dataUrl</strong> with additional parameters like rowid or some other values from the current row. Currently I suggest in the case the solution like described <a href="http://stackoverflow.com/a/8150307/315935" target="_blank">here</a>: to use <strong>data</strong> parameter of <strong>ajaxSelectOptions</strong>, where one get the value of currently selected row. The way could wotk in many scenarios, but it&#39;s not safe especially in multiselect scenario.</p>
<p>I suggest to allow to define <strong>dataUrl</strong>&#160;as function which will get some parameters (like <strong>options.id</strong>, <strong>options.name</strong>, ...) which describes the context. In general one can just include testing whether <strong>dataUrl</strong>&#160;is a function in the line like <a href="https://github.com/tonytomov/jqGrid/blob/v4.4.1/js/grid.common.js#L347" target="_blank">this</a> and if needed one can call the function with the corresponding parameters from the current context.</p>
<p>Best regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Thu, 08 Nov 2012 19:07:19 +0200</pubDate>
        </item>
</channel>
</rss>