Author: vmolotkov
Date: 2007-11-09 11:08:29 -0500 (Fri, 09 Nov 2007)
New Revision: 3874
Modified:
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
Log:
the changed custom events
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
16:01:36 UTC (rev 3873)
+++
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-09
16:08:29 UTC (rev 3874)
@@ -72,16 +72,16 @@
var topControl = document.getElementById(firstControlId);
var bottomControl = document.getElementById(lastControlId);
if (upControl) {
- upControl.onclick = function(e) {obj.moveSelectedItems('up', e);return
false;};
+ Shuttle.addClickListener(upControl, function(e) {obj.moveSelectedItems('up',
e);return false;});
}
if (downControl) {
- downControl.onclick = function(e) {obj.moveSelectedItems('down', e);return
false;};
+ Shuttle.addClickListener(downControl, function(e)
{obj.moveSelectedItems('down', e);return false;});
}
if (topControl) {
- topControl.onclick = function(e) {obj.moveSelectedItems('first', e);return
false;};
+ Shuttle.addClickListener(topControl, function(e)
{obj.moveSelectedItems('first', e);return false;});
}
if (bottomControl) {
- bottomControl.onclick = function(e) {obj.moveSelectedItems('last', e);return
false;};
+ Shuttle.addClickListener(bottomControl, 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;
@@ -495,7 +495,7 @@
if (item._selected) {
result.push(Shuttle.SELECTION_MARKER);
}
- if (this.activeItem.rowIndex == item._node.rowIndex) {
+ if (this.activeItem && (this.activeItem.rowIndex == item._node.rowIndex)) {
result.push(Shuttle.ACTIVITY_MARKER);
}
if (i != (this.shuttleItems.length - 1)) {
@@ -506,7 +506,9 @@
}
Shuttle.prototype.saveState = function() {
- this.valueKeeper.value = this.toString();
+ if (this.activeItem != null || (this.selectedItems.length > 0)) {
+ this.valueKeeper.value = this.toString();
+ }
}
Shuttle.prototype.compareByLabel = function(obj1, obj2) {
@@ -528,3 +530,16 @@
Shuttle.setFocus = function(targetObjectId) {
document.getElementById(targetObjectId).focus();
}
+
+Shuttle.addEventListener = function(elem, event, func) {
+ if (window.attachEvent) {
+ elem.attachEvent("on" + event, func);
+ } else {
+ elem.addEventListener(event, func, false);
+ }
+}
+
+Shuttle.addClickListener = function(elem, func) {
+ Shuttle.addEventListener(elem, "click", func);
+}
+
Show replies by date