From 2a12aca66a1502d0088564a390327e12337314fd Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Mon, 9 Mar 2015 22:59:48 +0100 Subject: [PATCH] Fixed: Selecting range with shift-key in Series Editor should now work as intended. --- src/UI/Cells/SelectAllCell.js | 17 +++++++++-------- src/UI/Series/Editor/SeriesEditorLayout.js | 2 ++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/UI/Cells/SelectAllCell.js b/src/UI/Cells/SelectAllCell.js index 86282b6c1..e89289f40 100644 --- a/src/UI/Cells/SelectAllCell.js +++ b/src/UI/Cells/SelectAllCell.js @@ -4,14 +4,16 @@ var BackgridSelectAll = require('backgrid.selectall'); module.exports = BackgridSelectAll.extend({ enterEditMode : function(e) { - if (e.shiftKey && this.model.collection.lastToggled) { - this._selectRange(); + var collection = this.column.get('sortedCollection') || this.model.collection; + + if (e.shiftKey && collection.lastToggled) { + this._selectRange(collection); } var checked = $(e.target).prop('checked'); - this.model.collection.lastToggled = this.model; - this.model.collection.checked = checked; + collection.lastToggled = this.model; + collection.checked = checked; }, onChange : function(e) { @@ -20,8 +22,7 @@ module.exports = BackgridSelectAll.extend({ this.model.trigger('backgrid:selected', this.model, checked); }, - _selectRange : function() { - var collection = this.model.collection; + _selectRange : function(collection) { var lastToggled = collection.lastToggled; var checked = collection.checked; @@ -38,7 +39,7 @@ module.exports = BackgridSelectAll.extend({ model.trigger('backgrid:select', model, checked); }); - this.model.collection.lastToggled = undefined; - this.model.collection.checked = undefined; + collection.lastToggled = undefined; + collection.checked = undefined; } }); \ No newline at end of file diff --git a/src/UI/Series/Editor/SeriesEditorLayout.js b/src/UI/Series/Editor/SeriesEditorLayout.js index 8d9d1fc9b..2dd7dc3f0 100644 --- a/src/UI/Series/Editor/SeriesEditorLayout.js +++ b/src/UI/Series/Editor/SeriesEditorLayout.js @@ -145,6 +145,8 @@ module.exports = Marionette.Layout.extend({ return; } + this.columns[0].sortedCollection = this.seriesCollection; + this.editorGrid = new Backgrid.Grid({ collection : this.seriesCollection, columns : this.columns,