fix select 'upwards'

This commit is contained in:
Damien Churchill 2010-07-01 14:08:20 +01:00
parent 148fcdbe37
commit 43fb998651
1 changed files with 10 additions and 2 deletions

View File

@ -45,16 +45,24 @@ Ext.override(Ext.tree.MultiSelectionModel, {
if (this.lastSelNode.parentNode.id != parentNode.id) return; if (this.lastSelNode.parentNode.id != parentNode.id) return;
// Get the node indexes // Get the node indexes
var ni = parentNode.indexOf(node), var fi = parentNode.indexOf(node),
li = parentNode.indexOf(this.lastSelNode); li = parentNode.indexOf(this.lastSelNode);
// Swap the values if required
if (fi > li) {
fi = fi + li, li = fi - li, fi = fi - li;
}
// Select all the nodes // Select all the nodes
parentNode.eachChild(function(n) { parentNode.eachChild(function(n) {
var i = parentNode.indexOf(n); var i = parentNode.indexOf(n);
if (li < i && i <= ni) { if (fi < i && i < li) {
this.select(n, e, true); this.select(n, e, true);
} }
}, this); }, this);
// Select the clicked node
this.select(node, e, true);
} else { } else {
this.select(node, e, e.ctrlKey); this.select(node, e, e.ctrlKey);
} }