I am using Ext.view.View for my data view. When I select one item ‘selectionchange’ event trigger twice. But without “multiSelect:true” it only trigger once.
Ext.define('myViewView', {
extend: 'Ext.view.View',
alias: 'widget.myViewView',
store: myContentStore,
cls: 'content-view-view',
tpl: myContentViewTpl,
multiSelect: true,
trackOver: true,
overItemCls: 'x-item-over',
itemSelector: '.thumb-wrap',
emptyText: emptyDataText,
resizable: true,
style: {
overflow: 'auto'
},
listeners: {
selectionchange: function(dv, selections) {
}
},
prepareData: function(data) {
Ext.apply(data, {
sizeString: Ext.util.Format.fileSize(data.size),
modifiedString: Ext.util.Format.date(data.modified, "m-d-Y:g-i-a"),
fileFormatPath: createBreadCrumb(data.filePath, false)
});
return data;
}
});
It fires twice only if you select something else (eg. you have selected one row and you select other one). First event is fired because you deselect first row, and second is fired after other row is truly selected.
Easiest solution is to set buffer for the event handler.
Example:
or