PDA

View Full Version : [OPEN] [FIXED]selectionchange event is fired twice



steffenk
18 Feb 2011, 12:54 PM
This looks weird, the event is fired twice, and with different arguments.

Go to this page
http://dev.sencha.com/deploy/ext-4.0-pr1/examples/grid/array-grid.html

Open console and execute this script, then click on grid.

cls = Ext.grid.GridPanel;
Ext.util.Observable.capture(cls.prototype, function() {
console.log(arguments);
}, cls);

evant
19 Feb 2011, 2:28 AM
Can't confirm this. What browser are you using? Note that the selectionchange event is fired for both selection and deselection.

steffenk
19 Feb 2011, 2:42 AM
Hi Evan,

i'm on FF4b and observe in FB 1.7X

Ok, deselect make sense. But if i look to the arguments i can't differ between both.

First event has arguments
"selectionchange", Object event, []

Second has
"selectionchange", Object event, Object record

looking to event object, there is no advice about select or deselect, they are looking identical (maybe i oversee something ?)
In event.events i find 3 events: select, deselect and selectionchanged, but select/deselect seems not to be fired.

evant
19 Feb 2011, 3:35 AM
I'm not seeing that.

See the attached screen. The first event is fired when I click the first row. The next 2 are fired after I click the second row (deselects the first).

steffenk
19 Feb 2011, 4:22 AM
You are right with the count of events (I already confirmed if one is for select, the other for deselect)

But then,
* select/deselect event is missing
* examine both selectionchange events. I think first is the deselect, it's fired without record.
* There is no indicator in event object of both, which kind it is (select/deselect)

evant
20 Feb 2011, 6:20 PM
In 3.x it makes no distinction as to whether it's a deselect/select as well. If you need a specific event, you should listen to select/deselect.

I've added a fix to ensure select/deselect get fired.