diff --git a/src/inputs/list.js b/src/inputs/list.js
index 2bef047..5d3d864 100644
--- a/src/inputs/list.js
+++ b/src/inputs/list.js
@@ -138,8 +138,11 @@ List - abstract class for inputs that have source option loaded from js array or
}
}, this)
});
- } else { //options as json/array
- this.sourceData = this.makeArray(this.options.source);
+ } else { //options as json/array/function
+ 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)) {
this.doPrepend();
success.call(this);
@@ -243,7 +246,8 @@ List - abstract class for inputs that have source option loaded from js array or
Array format is: [{value: 1, text: "text"}, {...}]
For compability it also supports format {value1: "text1", value2: "text2" ...}
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 sourceCache
option.
-
+ If source is **function**, should return data in array format: [{value: 1, text: "text"}, {...}]
or object format: {value1: "text1", value2: "text2" ...}
+
@property source
@type string|array|object
@default null