У меня есть 2 js-файла, один из которых определяет комбо, второй файл - это окно, которое вызывает объявление комбо ..
в файле окна я пытаюсь добавить или переопределить некоторый слушатель, но слушатель не работает
вот комбо:
App.form = function() {
return {
ComboCouch: function(config) {
var store = new Ext.data.JsonStore({
autoDestroy: true,
autoLoad:(config.autoLoad==true)?true:false,
storeId :config.storeId,
url: config.couchView,
root: 'rows',
fields: ['key', 'value']
});
var combo = new Ext.form.ComboBox({
store: store,
valueField: "key",
displayField: "value",
typeAhead: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
selectOnFocus:true/*, this when i try to override
listeners: {
'expand': function(c) {
c.store.reload();
}
}*/
});
Ext.apply(combo,config);
return combo;
}
};
}();
Ext.reg("appcombocouch",App.form.ComboCouch);
а это мое окно:
App.Download = function() {
return {
dialog : null,
init : function() {
this.baseUrl = '/';
this.whoami = null;
if (!App.urlRewrite) this.baseUrl = '/' + App.database + this.baseUrl;
if (App.Privilage.length==2 && (App.Privilage =="00" || App.Privilage <=0)) this.whoami = "Admin";
else if (App.Privilage.length==2 && (App.Privilage !="00" || App.Privilage >0)) this.whoami = "Prop";
else this.whoami = "Kab";
},
createItems : function(){
var items = new Array();
if(this.whoami == "Admin"){
items.push({
fieldLabel: 'Pilih Provinsi',
title : 'Provinsi',
xtype: 'appcombocouch',
couchView : 'r_propinsi',
width:250,
name : 'kd_prop',
autoLoad : true,
scope : this,
//this, i want to add/pverride listener
listeners: {
'expand': function(c) {
Ext.Msg.alert("test","do you see me");// this alert never show, when the combo expanded
c.store.reload();
}
}
});
}
var form = new Ext.form.FormPanel({
labelWidth:110,
//url:'php/download.php',
frame:true,
autoHeight:true,
title:'Download DBF',
defaultType:'textfield',
monitorValid:true,
items : [items]
})
return form;
},
show : function() {
if (!this.dialog) {
this.dialog = new Ext.Window({
items: [this.createItems()],
});
}
this.dialog.show();
}
};
}();
Ext.onReady(App.Download.init, App.Download, true);