Skip to content

Commit

Permalink
dataUrl now can be a function
Browse files Browse the repository at this point in the history
  • Loading branch information
tonytomov committed May 23, 2013
1 parent 40d33b2 commit 108d04e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js/grid.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ $.extend($.jgrid,{
rowid = $.jgrid.stripPref($t.p.idPrefix, rowid);
}
$.ajax($.extend({
url: options.dataUrl,
url: $.isFunction(options.dataUrl) ? options.dataUrl.call($t, rowid, vl, String(options.name)) : options.dataUrl,
type : "GET",
dataType: "html",
data: $.isFunction(postData) ? postData.call($t, rowid, vl, String(options.name)) : postData,
Expand Down

1 comment on commit 108d04e

@OlegKi
Copy link
Contributor

@OlegKi OlegKi commented on 108d04e May 23, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine!

Another thing about which I think last time. What do you think about extending parameters of dataInit with additional parameters like rowid or some more (column name for example). Currently dataInit be called from bindEv. The $.jgrid.bindEv will be called from two searching modules (toolbar and filter) and from tree editing modes. You extended parameters of callbacks of form editing with additional parameter frmoper which can be "add" or "edit". I find the changes very good because one need sometime do different things for adding and editing. In the same way one need sometime do different things in dataInit callback depend on the context of usage.

For example one can initialize datepicker with different options in searching toolbar, inline or cell editing (where we have restricted place) and Searching Dialog and editing form. One can use showOn: "button" option in form editing and searching dialog and don't use it in other cases.

In the same way it could be practical to call autocomplete inside of dataInit with source having additional parameter rowid or with other parameter from the current line (one can get the information if rowid is known).

What do you think about such extension of dataInit?

Best regards
Oleg

Please sign in to comment.