PDA

View Full Version : items config as a function



william.millington
31 Jul 2013, 12:01 PM
Hey, I have a checkboxfield that will be filled will an indeterminate number of check boxes at the time of its inception, given by a parameter passed to its parent container. I've tried adding them through referencing it by id after its instantiation, but I get an 'undefined' definition.

I'm wondering if there's any way to set up the items: config as a function

(i.e.
...
items: function(){
.....
return somearray;
}
....
)

or if there is an alternate, similar workaround available to add an unknown number of items to a checkboxfield at runtime?

Thanks for any help you can give

evant
31 Jul 2013, 2:45 PM
Make it a self executing function:



items: (function() {
var items = [];
items.push({});
return items;
})()

william.millington
1 Aug 2013, 3:43 AM
HUZZAH!

It works!

Thanks!