Author: vmolotkov
Date: 2007-11-06 15:38:43 -0500 (Tue, 06 Nov 2007)
New Revision: 3809
Modified:
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
Log:
corrected scrolling
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-06
20:12:16 UTC (rev 3808)
+++
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-06
20:38:43 UTC (rev 3809)
@@ -111,7 +111,7 @@
this.rebuild();
}
-Shuttle.prototype.moveSelectedItems = function(action) {
+Shuttle.prototype.moveSelectedItems = function(action, event) {
var rows = this.shuttleTbody.rows;
var item;
if (this.selectedItems.length > 0) {
@@ -146,7 +146,6 @@
}
}
- this.autoScrolling(action);
this.shuttleItems = new Array();
for (var i = 0; i < rows.length; i++) {
this.shuttleItems.push(rows[i].item);
@@ -219,8 +218,8 @@
Shuttle.prototype.onkeydownHandler = function(event) {
var action = null;
switch (event.keyCode) {
- case 34 : this.moveSelectedItems('last'); break; //page down
- case 33 : this.moveSelectedItems('first'); break; //page up
+ case 34 : action = 'last'; this.moveSelectedItems(action); break; //page down
+ case 33 : action = 'first'; this.moveSelectedItems(action); break; //page up
case 38 : //up arrow
action = 'up';
if (event.ctrlKey) {
@@ -239,23 +238,29 @@
break;
case 65 : // Ctrl + A
if (event.ctrlKey) {
- this.selectAll();
- if (event.stopPropagation) {
- event.preventDefault();
- event.stopPropagation();
- } else {
- event.cancelBubble = true;
- }
+ this.selectAll();
+ Shuttle.stopPropogation(event);
}
this.activeItem.className = Shuttle.ACTIVE_ITEM_CLASS;
this.saveState();
break;
case 32 : this.invertSelection(event); break; //blank
}
- if (action != null) this.autoScrolling(action);
+ if (action != null)
+ this.autoScrolling(action, event);
this.saveState();
}
+Shuttle.stopPropogation = function(event) {
+ if (event.stopPropagation) {
+ event.preventDefault();
+ event.stopPropagation();
+ } else {
+ event.cancelBubble = true;
+ event.returnValue = false;
+ }
+}
+
Shuttle.prototype.invertSelection = function(event) {
var eventItem = this.activeItem;
var eventShuttleItem = this.getSelectItemByNode(eventItem);
@@ -387,7 +392,7 @@
return null;
}
-Shuttle.prototype.autoScrolling = function(action) {
+Shuttle.prototype.autoScrolling = function(action, event) {
this.selectedItems.sort(this.compareByRowIndex);
var targetItemTop;
if (action == 'up' || action == 'first') {
@@ -400,6 +405,7 @@
var increment = targetItemTop - (this.shuttleTop +
this.shuttleTable.parentNode.offsetHeight - LayoutManager.SCROLL_WIDTH);
this.shuttleTable.parentNode.scrollTop = increment;
}
+ Shuttle.stopPropogation(event);
}
/*Shuttle.prototype.init = function() {
Show replies by date