PDA

View Full Version : Custom views: when to use config?



estesbubba
30 Dec 2011, 8:30 AM
So several of us here are trying to figure out when properties should go into config and when they should be at the class level? A lot of the examples show the entire view being built inside config. It appears this doesn't work with dynamic data but maybe we're missing something? For dynamic views we are doing:



config: {}
initialize: funciton() {
this.setItems(this.buildItems());
}
buildItems: function() {
return { view stuff }
}


So is there an easy rule of thumb on what does into config and what goes at the class level? We thought maybe anything that could be changed after creation goes into config. Maybe there's a good write up on this and we just haven't found it?

mitchellsimoens
30 Dec 2011, 8:37 AM
The config object is great if you want the whole getter/setter architecture that comes along with them. That's the thing that I use it most for. I put everything in the config personally.