Added support for prepend as a function

This commit is contained in:
bchance
2012-12-12 14:38:21 -06:00
committed by vitalets
parent 2f421a5338
commit ffa133b2fb

@ -163,7 +163,10 @@ List - abstract class for inputs that have source option loaded from js array or
if (typeof this.options.prepend === 'string') { if (typeof this.options.prepend === 'string') {
this.options.prepend = {'': this.options.prepend}; this.options.prepend = {'': this.options.prepend};
} }
this.prependData = this.makeArray(this.options.prepend); if (typeof this.options.prepend === 'function')
this.prependData = this.makeArray(this.options.prepend());
else
this.prependData = this.makeArray(this.options.prepend);
} }
if($.isArray(this.prependData) && $.isArray(this.sourceData)) { if($.isArray(this.prependData) && $.isArray(this.sourceData)) {
@ -257,7 +260,7 @@ List - abstract class for inputs that have source option loaded from js array or
Data automatically prepended to the beginning of dropdown list. Data automatically prepended to the beginning of dropdown list.
@property prepend @property prepend
@type string|array|object @type string|array|object|function
@default false @default false
**/ **/
prepend:false, prepend:false,