PDA

View Full Version : [UNKNOWN][3.1svn5843] Weird ItemSelector bug



canxss
29 Dec 2009, 1:18 PM
Hi,

I don't know how to explain the problem clearly but basically an ItemSelector fires the 'change' event handlers of the ComboBox'es which are on the same form or window with the ItemSelector.

Please run the code below (which is basically taken from multiselect-demo example), try the steps following the code and check out the console:



Ext.onReady(function() {

Ext.QuickTips.init();

var comboConfig = {
xtype: 'combo',
width: 135,
valueField: 'value',
displayField: 'text',
typeAhead: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
store: new Ext.data.ArrayStore({
data: [ ['1', 'A'], ['2', 'B'], ['3', 'C'] ],
fields: ['value', 'text'],
sortInfo: {
field: 'value',
direction: 'ASC'
}
}),
listeners: {
'change': function(field, newValue, oldValue) {
console.log(field.id + ' change:', newValue, oldValue);
},
scope: this
}
};

var ds = new Ext.data.ArrayStore({
data: [[123,'One Hundred Twenty Three'],
['1', 'One'], ['2', 'Two'], ['3', 'Three'], ['4', 'Four'], ['5', 'Five'],
['6', 'Six'], ['7', 'Seven'], ['8', 'Eight'], ['9', 'Nine']],
fields: ['value','text'],
sortInfo: {
field: 'value',
direction: 'ASC'
}
});

var isForm = new Ext.form.FormPanel({
title: 'ItemSelector Test',
width:700,
bodyStyle: 'padding:10px;',
items:[
Ext.apply(comboConfig, {id: 'combo2'}),
{
xtype: 'itemselector',
name: 'itemselector',
drawUpIcon: false,
drawDownIcon: false,
drawTopIcon: false,
drawBotIcon: false,
fieldLabel: 'ItemSelector',
multiselects: [{
width: 250,
height: 200,
store: ds,
displayField: 'text',
valueField: 'value'
},{
width: 250,
height: 200,
store: [['10','Ten']],
tbar:[{
text: 'clear',
handler:function(){
isForm.getForm().findField('itemselector').reset();
}
}]
}]
}]
});

var win = new Ext.Window({
width: 750,
height: 350,
items: isForm,
tbar: [Ext.apply(comboConfig, {id: 'combo1'})]
});

win.show();
});


A-1. After the window renders without changing anything click the items in the "Available" box: You should see nothing on the console.

B-1. Select an item from the ComboBox on the toolbar ("combo1"), focus out and you should see the ''combo1 change:...." log on the console which is expected.
B-2. Now click an item in the "Available" box: You should see the same ''combo1 change:...." log for each click on the console which is weird.

C-1. Select an item from the ComboBox on the form ("combo2", which is above the "Available box"), focus out and you should see the ''combo2 change:...." log on the console which is expected.
C-2. Now again click an item in the "Available" box: You should see
''combo1 change:....
combo2 change:....
combo2 change:...." multiple logs for each click on the console.

Thanks in advance

canxss
9 Jan 2010, 3:24 AM
Hi,

I've updated Ext JS from SVN to revision 5863 and the problem still exists. When will it be fixed?

Thanks

Condor
9 Jan 2010, 4:29 AM
Isn't this the same problem as this one (http://www.extjs.com/forum/showthread.php?t=86564)?

canxss
9 Jan 2010, 12:12 PM
Yes, they are the same! Thanks, I will follow that thread.