3
votes

I made a Fiddle test case to reproduce my problem: the select event is fired twice. Even the selectionchange does so. But the cellclick is fired only once. I use ExtJS5.1.1 GPL.

NB: the Load button (on the left) has to be clicked first.

2
Make valueField unique. duplicate values causes multiple events.abhishek kumar
Sorry Abhishek, I did not understand your comment, can you explain it with an example please?Michel

2 Answers

1
votes

This looks like a bug...

An ugly workaround can be using buffer. You can set the listener like this:

select: {
  buffer: 1,
  fn: function(treepanel, record, index) {
     console.log('select', index);
  }
}
1
votes

The listener is added to the events twice, this is a bug in Sencha Framework that relates to the locked/normal treegrid and is fixed in 5.1.2. It seems as if the listener is added once to the listener object of the locked grid and once to the listener object of the normal grid, and because both grids use the very same object, that object will contain the listener twice.

A quick fix seems to be to remove the select listener from the listener config and add it to one of the grids only:

Ext.ComponentQuery.query('viewport treepanel[isLocked=true]')[0].on('select', function(treepanel, record, index) {
    console.log('select', index);
});