PDA

View Full Version : Cannot update comboBox after modifying store only when first.



cleanpotato
3 Jun 2012, 3:35 AM
Ext.define('TAdmin.controller.Organization', {
extend: 'Ext.app.Controller',
...
init: function () {
this.control({
'combo[name=category1]' : {
select: this.handlerCategory1
},
'combo[name=category2]' : {
select: this.handlerCategory2
},
});
},
...
handlerCategory1: function (combo, record, opt) {
var child = record[0].child(),
category2 = this.getCategory2(),
category3 = this.getCategory3(),
category2_store = category2.getStore();


if (child.count() == 0) {
category2.disable();
} else {
category2.enable();


category2_store.removeAll(false);
child.each( function(record) {
category2.getStore().add(record);
});
category2.getStore().each(function (record) {
console.log(record.get('title'));
});
}


category2.select(null);
category3.select(null);
},




There are 3 comboboxes in my formfield panel.
I want that user selects first combobox, the second combox's store must be modified, so I use "select" event and write the code for modifying second combobox's store in fist combobox's "select" event handler.

It doesn't work only first time.
Are there any faults in my source code or what is the problem..???
Please, let me know..