Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






support dataUrl as function

UserPost

19:07
08/11/2012


OlegK

Germany

Member

posts 1210

Post edited 19:46 – 08/11/2012 by OlegK


Hello Tony,

I read frequently the requirement to use dataUrl with additional parameters like rowid or some other values from the current row. Currently I suggest in the case the solution like described here: to use data parameter of ajaxSelectOptions, where one get the value of currently selected row. The way could wotk in many scenarios, but it's not safe especially in multiselect scenario.

I suggest to allow to define dataUrl as function which will get some parameters (like options.id, options.name, …) which describes the context. In general one can just include testing whether dataUrl is a function in the line like this and if needed one can call the function with the corresponding parameters from the current context.

Best regards
Oleg

14:32
27/04/2013


OlegK

Germany

Member

posts 1210

Hello Tony,

there are exist more and more public services which supports RESTful API. For example Windows Azure Mobile Services REST API an example. The exsiting services can require to use rowid as the part of URL (see here and here for example). The current implementation of Save button of inlineNav or the implementation dataUrl of still don't allow to modify the URL by appending "/" + encodeURIComponent(rowid). The feature postData as function allows to post rowid, but not as the part of URL.

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 the line

url: options.dataUrl,

in the same way as the line with data option

data: $.isFunction(postData) ? postData.call($t, rowid, vl, String(options.name)) : postData,

it will get the most flexibility. I mean the code like

url: $.isFunction(options.dataUrl) ?
         options.dataUrl.call($t, rowid, vl, String(options.name)) :
         options.dataUrl,

The same changes one could do in other parts of jqGrid where jQuery.ajax are used. The most important place seems for me saveRow, bacause there are no way to modify url dynamically especially in case of usage "Save" button of inlineNav.

Simple modification of the line 

url:o.url,

to something like

url: $.isFunction(o.url) ? o.url.call($t, rowid, tmp3) : o.url,

will give developer full flexibility to generate URL dynamically.

Best regards
Oleg


11:48
29/04/2013


tony

Sofia, Bulgaria

Moderator

posts 7383

Hello Oleg,


Thanks. I will try to implement this later.


Kind Regards

For professional UI suites for PHP, ASP.NET and ASP.NET MVC visit us at our commercial products site – trirand.net – by the very same guys that created jqGrid.


About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

215


Currently Online:

lucassus

26 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 10274

Posts: 30362

Membership:

There are 11039 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1210

markw65 – 179

kobruleht – 144

phicarre – 132

YamilBracho – 124

Renso – 118

Administrators: admin (60 Posts)

Moderators: tony (7383 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information