Author: vmolotkov
Date: 2007-11-09 09:08:14 -0500 (Fri, 09 Nov 2007)
New Revision: 3861
Modified:
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
Log:
scrolling was corrected
Modified:
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
===================================================================
---
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-09
13:45:58 UTC (rev 3860)
+++
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-09
14:08:14 UTC (rev 3861)
@@ -69,19 +69,19 @@
Shuttle.setFocus(focusKeeperId);
var upControl = document.getElementById(upControlId);
var downControl = document.getElementById(downControlId);
- var topControl = document.getElementById(lastControlId);
+ var topControl = document.getElementById(firstControlId);
var bottomControl = document.getElementById(lastControlId);
if (upControl) {
- upControl.onclick = function() {obj.moveSelectedItems('up');return false;};
+ upControl.onclick = function(e) {obj.moveSelectedItems('up', e);return
false;};
}
if (downControl) {
- downControl.onclick = function() {obj.moveSelectedItems('last');return
false;};
+ downControl.onclick = function(e) {obj.moveSelectedItems('down', e);return
false;};
}
if (topControl) {
- topControl.onclick = function() {obj.moveSelectedItems('first');return
false;};
+ topControl.onclick = function(e) {obj.moveSelectedItems('first', e);return
false;};
}
if (bottomControl) {
- bottomControl.onclick = function() {obj.moveSelectedItems('last');return
false;};
+ bottomControl.onclick = function(e) {obj.moveSelectedItems('last', e);return
false;};
}
document.getElementById(contentTableId).onclick = function(e)
{obj.onclickHandler(window.event || e);};
this.shuttleTop = LayoutManager.getElemXY(this.shuttleTable).top;
@@ -135,6 +135,7 @@
}
Shuttle.prototype.moveSelectedItems = function(action, event) {
+ event = window.event||event;
var rows = this.shuttleTbody.rows;
var item;
if (this.selectedItems.length > 0) {
@@ -173,6 +174,8 @@
for (var i = 0; i < rows.length; i++) {
this.shuttleItems.push(rows[i].item);
}
+ if (action != null)
+ this.autoScrolling(action, event);
this.saveState();
}
}
@@ -245,22 +248,22 @@
Shuttle.prototype.onkeydownHandler = function(event) {
var action = null;
switch (event.keyCode) {
- case 34 : action = 'last'; this.moveSelectedItems(action); break; //page down
- case 33 : action = 'first'; this.moveSelectedItems(action); break; //page up
+ case 34 : action = 'last'; this.moveSelectedItems(action ,event); break; //page
down
+ case 33 : action = 'first'; this.moveSelectedItems(action, event); break;
//page up
case 38 : //up arrow
action = 'up';
if (event.ctrlKey) {
- this.moveSelectedItems(action);
+ this.moveSelectedItems(action, event);
} else {
- this.moveActiveItem(action);
+ this.moveActiveItem(action, event);
}
break;
case 40 : //down arrow
action = 'down';
if (event.ctrlKey) {
- this.moveSelectedItems(action);
+ this.moveSelectedItems(action ,event);
} else {
- this.moveActiveItem(action);
+ this.moveActiveItem(action, event);
}
break;
case 65 : // Ctrl + A
@@ -271,11 +274,10 @@
this.activeItem.className = Shuttle.ACTIVE_ITEM_CLASS;
this.saveState();
break;
- case 32 : this.invertSelection(event); break; //blank
+ case 32 : this.invertSelection(event); this.saveState(); break; //blank
}
- if (action != null)
- this.autoScrolling(action, event);
- this.saveState();
+ //if (action != null)
+ // this.autoScrolling(action, event);
}
Shuttle.stopPropogation = function(event) {
@@ -300,7 +302,7 @@
}
}
-Shuttle.prototype.moveActiveItem = function(action) {
+Shuttle.prototype.moveActiveItem = function(action, event) {
var item = this.activeItem;
var rows = this.shuttleTbody.rows;
if ((action == 'up') && (item.rowIndex > 0)) {
@@ -308,6 +310,9 @@
} else if ((action == 'down') && (item.rowIndex <
this.shuttleItems.length - 1)) {
this.changeActiveItems(rows[item.rowIndex + 1], item);
}
+
+ this.saveState();
+ this.autoScrolling(action, event);
}
Shuttle.prototype.changeActiveItems = function(newItem, item) {
Show replies by date