PDA

View Full Version : single combobox on many panels



iceblast_01
18 Aug 2009, 1:02 AM
hello, cant i have a single combobox and put it on many panels?


var combo = new Ext.form.ComboBox({
store: store,
displayField:'state',
....
});
var panel1 = new Ext.Panel({
....
items:combo,
....
});
var panel2 = new Ext.Panel({
....
items:combo,
....
});
combobox dont show on panel2, i want to reuse my combobox since i use the same combobox on my panels
cant i do that?

Lukman
18 Aug 2009, 3:38 AM
I don't think you can use single instantiated combobox at different places on the same browser page .. you can use single config options but when instantiated at those places, they are separated comboboxes inside the DOM structure ...

But why? If you want the comboboxes to have the same list of values, then make them share the same store. If you want any update on one of them to also apply on the others then you probably have to do it the event-listener way.

iceblast_01
18 Aug 2009, 5:06 PM
ok thanks, yes im using the same store for my comboboxes but i thought i may use the same instance of the combobox for multiple panels, so i have to create a combobox for each panel that i would use that combobox on. :D