PDA

View Full Version : [FIXED] Ext.DataView.beforeselect not firing



n3rd
10 Mar 2011, 1:24 AM
The documentation specifies the 'beforeselect' event, but it appears that this event is never triggered.

A quick look at Ext.DataView's source seems to confirm this: the event is indeed never fired.

Edit: Apparently, this has been mentioned before (http://www.sencha.com/forum/showthread.php?121675-OPEN-732-DataView.beforeselect-event-is-never-actually-fired) but no feedback was given.

n3rd
16 Mar 2011, 2:11 AM
Unfortunately, the bug was not resolved in PR4:



onSelectChange: function(record, isSelected, suppressEvent) {
var me = this,
view = me.view,
allowSelect = true,
select;

if (isSelected) {
if (!suppressEvent) {
select = me.fireEvent('beforeselect', me, record) !== false;
}
if (allowSelect) {
view.onItemSelect(record);
if (!suppressEvent) {
me.fireEvent('select', me, record);
}
}
} else {
view.onItemDeselect(record);
if (!suppressEvent) {
me.fireEvent('deselect', me, record);
}
}
}

The "beforeselect" event is indeed now fired, but its return value is completely ignored. I don't want to be a ******, but it seems to me like that feature was implemented but never actually tested or even used...

evant
16 Mar 2011, 2:33 AM
Looks like I accidentally committed without saving:



Ext.selection.DataViewModel.override({
onSelectChange: function(record, isSelected, suppressEvent) {
var me = this,
view = me.view,
allowSelect = true;

if (isSelected) {
if (!suppressEvent) {
allowSelect = me.fireEvent('beforeselect', me, record) !== false;
}
if (allowSelect) {
view.onItemSelect(record);
if (!suppressEvent) {
me.fireEvent('select', me, record);
}
}
} else {
view.onItemDeselect(record);
if (!suppressEvent) {
me.fireEvent('deselect', me, record);
}
}
}
});

n3rd
16 Mar 2011, 3:36 AM
Thanks a lot for the quick reply. It's very much appreciated!