PDA

View Full Version : Does select have a setOptions like method?



profunctional
19 Jul 2010, 5:31 PM
I'm trying to set a select form object's options. I'm trying something like

assignApptForm.getComponent('assignApptFormTeam').getComponent('ddlAssignTo').setList(users, true);

which is the same pattern I've been using to populate the nested list object. This obviously fails since there is no setList method, but is there anything similar?

evant
19 Jul 2010, 10:01 PM
It doesn't, but it's quite trivial to do:



//main setup
Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: true,
onReady: function(){


var select = new Ext.form.Select({
options: []
}).show();

new Ext.Button({
text: 'Add options',
handler: function(){
var el = select.fieldEl;
el.dom.innerHTML = '<option value="1">Foo</option><option value="2">Bar</option>';
}
}).show();

}
});


There's also other methods you can get some ideas from about manipulating them in other ways here: http://github.com/SamWM/jQuery-Plugins/blob/master/selectboxes/jquery.selectboxes.js