PDA

View Full Version : [B3] ComboBox : Ext.AbstractDataView error on bindStore



pkli
23 Apr 2011, 6:29 AM
Hello,

I have two combobox (local store) in a form.
Change selection in the first combo load a new store in the second one.

Sometimes, there is an error in Ext.AbstractDataView when trying to set class of selected item.
line 45255 and 45261 : node is undefined

Awaiting your reply, I made ??a small change to prevent it.



Ccombos code :




var ContatctsDescs = [];
ContatctsDescs[1] = [["MAIN","Principal"],["WORK","Professionnel"],["HOME","Personnel"]];
ContatctsDescs[2] = [["MAIN","Principal"],["WORK","Professionnel"],["HOME","Personnel"]];
ContatctsDescs[3] = [["MAIN","Principal"],["WORK","Professionnel"],["HOME","Personnel"]];
ContatctsDescs[4] = [["MAIN","Principal"],["WORK","Professionnel"],["HOME","Personnel"],["FB","Facebook"],["Twitter","Twitter"],["RSS","RSS"]];
ContatctsDescs[5] = [["MAIN","Principal"],["WORK","Professionnel"],["HOME","Personnel"],["Skype","Skype"],["IChat","IChat"],["MSN","MSN"]];


var ContactsTypes = new Ext.form.ComboBox({
name:"contacts__type"
,id:"ext_contacts__type"
,flex: 1
,store: [[1,"Téléphone"],[2,"Fax"],[3,"Email"],[4,"Web"],[5,"Messagerie instantanée"]]
,emptyText:"type"
,editable:false
,forceSelection:true
,allowBlank:false
,value:1
,listeners : {
select : {
fn : function(){
ContactsDesc.bindStore(ContatctsDescs[this.value]);
ContactsDesc.setValue("MAIN");
}
}
}
});
var ContactsDesc = new Ext.form.ComboBox({
flex: 1
,name:"contacts__description"
,id:"ext_contacts__description"
,emptyText : "description"
,queryMode: "local"
,store: ContatctsDescs[ContactsTypes.value]
,editable:true
,forceSelection:false
,autoSelect:false
,allowBlank:false
,value:"MAIN"
,valueNotFoundText : ""
});



Original ext-all-debug.js with error :



onItemSelect: function(record) {
var node = this.getNode(record);
Ext.fly(node).addCls(this.selectedItemCls); // line 45255 : node is undefined
},


onItemDeselect: function(record) {
var node = this.getNode(record);
Ext.fly(node).removeCls(this.selectedItemCls); // line 45261 : node is undefined
},



Modified ext-all-debug.js, no error



onItemSelect: function(record) {
var node = this.getNode(record);
if (node) { Ext.fly(node).addCls(this.selectedItemCls); } // line 45255 : ok
},


onItemDeselect: function(record) {
var node = this.getNode(record);
if (node) { Ext.fly(node).removeCls(this.selectedItemCls); } // line 45261 : ok
},

ysyang99
3 May 2011, 10:36 PM
I have the same problem appears
I'm modify "ext-all-debug.js" as above code and no error