Forum

May 22nd, 2014
A A A

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
support dataUrl as function
08/11/2012
19:07
OlegK
Germany
Member
Forum Posts: 1216
Member Since:
10/08/2009
Offline

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

27/04/2013
14:32
OlegK
Germany
Member
Forum Posts: 1216
Member Since:
10/08/2009
Offline

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

29/04/2013
11:48
tony
Sofia, Bulgaria
Moderator
Forum Posts: 7571
Member Since:
30/10/2007
Offline

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.
Forum Timezone: Europe/Sofia

Most Users Ever Online: 215

Currently Online:
55 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1216

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11238

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10443

Posts: 30855

Newest Members: NoSalt, 80vele, George, Mallia, Sneha Mehta, Amit Prabhalkar

Moderators: tony (7571), Rumen[Trirand] (81)

Administrators: admin (61)

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information