Fixed: Selecting range with shift-key in Series Editor should now work as intended.

This commit is contained in:
Taloth Saldono 2015-03-09 22:59:48 +01:00
parent f5f050f80b
commit 2a12aca66a
2 changed files with 11 additions and 8 deletions

View File

@ -4,14 +4,16 @@ var BackgridSelectAll = require('backgrid.selectall');
module.exports = BackgridSelectAll.extend({ module.exports = BackgridSelectAll.extend({
enterEditMode : function(e) { enterEditMode : function(e) {
if (e.shiftKey && this.model.collection.lastToggled) { var collection = this.column.get('sortedCollection') || this.model.collection;
this._selectRange();
if (e.shiftKey && collection.lastToggled) {
this._selectRange(collection);
} }
var checked = $(e.target).prop('checked'); var checked = $(e.target).prop('checked');
this.model.collection.lastToggled = this.model; collection.lastToggled = this.model;
this.model.collection.checked = checked; collection.checked = checked;
}, },
onChange : function(e) { onChange : function(e) {
@ -20,8 +22,7 @@ module.exports = BackgridSelectAll.extend({
this.model.trigger('backgrid:selected', this.model, checked); this.model.trigger('backgrid:selected', this.model, checked);
}, },
_selectRange : function() { _selectRange : function(collection) {
var collection = this.model.collection;
var lastToggled = collection.lastToggled; var lastToggled = collection.lastToggled;
var checked = collection.checked; var checked = collection.checked;
@ -38,7 +39,7 @@ module.exports = BackgridSelectAll.extend({
model.trigger('backgrid:select', model, checked); model.trigger('backgrid:select', model, checked);
}); });
this.model.collection.lastToggled = undefined; collection.lastToggled = undefined;
this.model.collection.checked = undefined; collection.checked = undefined;
} }
}); });

View File

@ -145,6 +145,8 @@ module.exports = Marionette.Layout.extend({
return; return;
} }
this.columns[0].sortedCollection = this.seriesCollection;
this.editorGrid = new Backgrid.Grid({ this.editorGrid = new Backgrid.Grid({
collection : this.seriesCollection, collection : this.seriesCollection,
columns : this.columns, columns : this.columns,