Browse Source

- Allow the user to use SHIFT key to extend selection in Web UI transfer list

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
8a64412cb5
  1. 21
      src/webui/scripts/dynamicTable.js

21
src/webui/scripts/dynamicTable.js

@ -80,7 +80,7 @@ var dynamicTable = new Class ({ @@ -80,7 +80,7 @@ var dynamicTable = new Class ({
}
tr.addEvent('click', function(e){
if(e.control) {
found = false;
// CTRL key was pressed
if(this.cur.contains(id)) {
// remove it
this.cur.erase(id);
@ -98,8 +98,22 @@ var dynamicTable = new Class ({ @@ -98,8 +98,22 @@ var dynamicTable = new Class ({
}
}
} else {
//TODO: handle alt key
// Control key is not pressed
if(e.shift && this.cur.length == 1) {
// Shift key was pressed
ids = this.getRowIds();
beginIndex = ids.indexOf(this.cur[0]);
endIndex = ids.indexOf(id);
for(i=beginIndex+1; i<(endIndex+1); i++) {
curID = ids[i];
this.cur[this.cur.length] = curID;
// Add selected style
temptr = this.rows[curID];
if(temptr){
temptr.addClass(this.options.selectCls);
}
}
} else {
// Simple selection
// Remove selected style from previous ones
for(i=0; i<this.cur.length; i++) {
var temptr = this.rows[this.cur[i]];
@ -114,6 +128,7 @@ var dynamicTable = new Class ({ @@ -114,6 +128,7 @@ var dynamicTable = new Class ({
}
this.cur[0] = id;
}
}
}.bind(this));
tr.injectInside(this.table);

Loading…
Cancel
Save