Author: pkawiak
Date: 2009-03-08 08:02:57 -0400 (Sun, 08 Mar 2009)
New Revision: 12885
Modified:
trunk/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableHeader.js
Log:
RF-5086: fixing handling events with enableContextMenu='false'
Modified:
trunk/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableHeader.js
===================================================================
---
trunk/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableHeader.js 2009-03-06
20:28:39 UTC (rev 12884)
+++
trunk/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTableHeader.js 2009-03-08
12:02:57 UTC (rev 12885)
@@ -6,6 +6,7 @@
initialize: function($super, elementId, extDt) {
this.extDt = extDt;
this.extDtId = this.extDt.id;
+ this.enableContextMenu = this.extDt.options.enableContextMenu;
$super(elementId,extDt,true);
//register events
@@ -13,33 +14,35 @@
this.eventSepMouseDown = this.OnSepMouseDown.bindAsEventListener(this);
this.eventSepMouseMove = this.OnSepMouseMove.bindAsEventListener(this);
this.eventSepMouseUp = this.OnSepMouseUp.bindAsEventListener(this);
- if (this.extDt.options.enableContextMenu) {
- this.eventHeaderCellMouseOver = this.OnHeaderCellMouseOver.bindAsEventListener(this);
- this.eventHeaderCellMouseOut = this.OnHeaderCellMouseOut.bindAsEventListener(this);
+ this.eventHeaderCellMouseOver = this.OnHeaderCellMouseOver.bindAsEventListener(this);
+ this.eventHeaderCellMouseOut = this.OnHeaderCellMouseOut.bindAsEventListener(this);
+ if (this.enableContextMenu) {
+ var showMenuFct = this.extDt.options.showMenuFunction;
+ if (showMenuFct) {
+ this.showMenuFct = showMenuFct;
+ this.menuImageMouseDown = this.OnMenuImageMouseDown.bindAsEventListener(this);
+ };
}
if (this.extDt.sortFct) {
this.eventHeaderCellClicked =
this.OnHeaderCellMouseClicked.bindAsEventListener(this);
}
-
- var showMenuFct = this.extDt.options.showMenuFunction;
- if (showMenuFct) {
- this.showMenuFct = showMenuFct;
- this.menuImageMouseDown = this.OnMenuImageMouseDown.bindAsEventListener(this);
- };
-
this.createControl(elementId);
},
OnHeaderCellMouseOver: function(event) {
- var el = this.extDt._findParentElement(event, "th");
- var menuDiv = $(el.id+"header:menuDiv");
- menuDiv.className = "extdt-menu-div-on";
+ if (this.enableContextMenu) {
+ var el = this.extDt._findParentElement(event, "th");
+ var menuDiv = $(el.id+"header:menuDiv");
+ menuDiv.className = "extdt-menu-div-on";
+ }
},
OnHeaderCellMouseOut: function(event) {
- var el = this.extDt._findParentElement(event, "th");
- var menuDiv = $(el.id+"header:menuDiv");
- menuDiv.className = "extdt-menu-div-out";
+ if (this.enableContextMenu) {
+ var el = this.extDt._findParentElement(event, "th");
+ var menuDiv = $(el.id+"header:menuDiv");
+ menuDiv.className = "extdt-menu-div-out";
+ }
},
OnHeaderCellMouseClicked: function(event) {
@@ -88,13 +91,13 @@
if (headerChildChildren == null || headerChildChildren.size() == 0){
continue;
}
+ if (this.enableContextMenu) {
+ var menuImage = headerChildChildren[7];
+ Utils.DOM.Event.removeListeners(menuImage);
+ Utils.DOM.Event.observe(menuImage,'click',this.menuImageMouseDown);
+ };
var sepSpan = headerChildChildren[2];
- var menuImage = headerChildChildren[7];
- //remove listeners
- Utils.DOM.Event.removeListeners(menuImage);
Utils.DOM.Event.removeListeners(sepSpan);
- //add listeners
- Utils.DOM.Event.observe(menuImage,'click',this.menuImageMouseDown);
Utils.DOM.Event.observe(sepSpan, 'click', this.eventSepClick);
Utils.DOM.Event.observe(sepSpan, 'mousedown', this.eventSepMouseDown);
Utils.DOM.Event.observe(sepSpan, 'mousemove', this.eventSepMouseMove);
@@ -118,10 +121,11 @@
if (headerChildChildren == null || headerChildChildren.size() == 0){
continue;
}
+ if (this.enableContextMenu) {
+ var menuImage = headerChildChildren[7];
+ Utils.DOM.Event.removeListeners(menuImage);
+ }
var sepSpan = headerChildChildren[2];
- var menuImage = headerChildChildren[7];
-
- Utils.DOM.Event.removeListeners(menuImage);
Utils.DOM.Event.removeListeners(sepSpan);
};
},
Show replies by date