params as function overwrite original data instead of append

This commit is contained in:
vitalets
2012-12-10 13:11:33 +04:00
parent 5b18620b99
commit c674cdcfcb
4 changed files with 83 additions and 77 deletions

@ -264,7 +264,7 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
//additional params
if(typeof this.options.params === 'function') {
$.extend(params, this.options.params.call(this.options.scope, params));
params = this.options.params.call(this.options.scope, params);
} else {
//try parse json in single quotes (from data-params attribute)
this.options.params = $.fn.editableutils.tryParseJson(this.options.params, true);
@ -375,10 +375,13 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
**/
url:null,
/**
Additional params for submit. Function can be used to calculate params dynamically
Additional params for submit. If defined as <code>object</code> - it is **appended** to original ajax data (pk, name and value).
If defined as <code>function</code> - returned object **overwrites** original ajax data.
@example
params: function(params) {
return { a: 1 };
//originally params contain pk, name and value
params.a = 1;
return params;
}
@property params