Set select source to function
This commit is contained in:
@ -138,8 +138,11 @@ List - abstract class for inputs that have source option loaded from js array or
|
|||||||
}
|
}
|
||||||
}, this)
|
}, this)
|
||||||
});
|
});
|
||||||
} else { //options as json/array
|
} else { //options as json/array/function
|
||||||
this.sourceData = this.makeArray(this.options.source);
|
if (typeof this.options.source === 'function')
|
||||||
|
this.sourceData = this.makeArray(this.options.source());
|
||||||
|
else
|
||||||
|
this.sourceData = this.makeArray(this.options.source);
|
||||||
if($.isArray(this.sourceData)) {
|
if($.isArray(this.sourceData)) {
|
||||||
this.doPrepend();
|
this.doPrepend();
|
||||||
success.call(this);
|
success.call(this);
|
||||||
@ -243,7 +246,8 @@ List - abstract class for inputs that have source option loaded from js array or
|
|||||||
Array format is: <code>[{value: 1, text: "text"}, {...}]</code><br>
|
Array format is: <code>[{value: 1, text: "text"}, {...}]</code><br>
|
||||||
For compability it also supports format <code>{value1: "text1", value2: "text2" ...}</code> but it does not guarantee elements order.
|
For compability it also supports format <code>{value1: "text1", value2: "text2" ...}</code> but it does not guarantee elements order.
|
||||||
If source is **string**, results will be cached for fields with the same source and name. See also <code>sourceCache</code> option.
|
If source is **string**, results will be cached for fields with the same source and name. See also <code>sourceCache</code> option.
|
||||||
|
If source is **function**, should return data in array format: <code>[{value: 1, text: "text"}, {...}]</code> or object format: <code>{value1: "text1", value2: "text2" ...}</code>
|
||||||
|
|
||||||
@property source
|
@property source
|
||||||
@type string|array|object
|
@type string|array|object
|
||||||
@default null
|
@default null
|
||||||
|
Reference in New Issue
Block a user