Context menu destroyed not completely
-------------------------------------
Key: RF-8074
URL:
https://jira.jboss.org/jira/browse/RF-8074
Project: RichFaces
Issue Type: Bug
Components: component-output
Affects Versions: 3.3.2.SR1, 3.3.2.GA, 3.3.2.CR1, 3.3.1
Environment: IE7, Tomcat,
RichFaces 3.3.1
JSF 1.2_08
Reporter: Sergey Bondarev
Priority: Critical
Hello guys.
I've such situation:
We have some kind component which extends from ExtendedDataTable
It has context menu inside for each column. (i use it only for set visibility)
The task for me was to make possible attach this menu to link somewhere outside the
table.
Also it was done by using attachTo parameter.
This menu rerendered with their table each time when I change column visibility.
And at first time all works fine, but in second when i click on link to open menu, JS
exception 'value is required..' appears.
I've no additional debug tools till today, but I look inside related to the menu file
'context-menu.js' and see this one :
attachToElement : function(element, event, context) {
if (element) {
this.applyDecoration(element);
//Strip 'on' here
var evnName = event.substr(2);
//
http://jira.jboss.com/jira/browse/RF-3419
if(evnName == 'contextmenu') {
Richfaces.enableDefaultHandler('click');
}
var listener = this.show.bindAsEventListener(this, context);
Event.observe(element, evnName, listener);
<------here is listner assigned
}
},
but while rerendering this called:
destroy: function() {
this.enableDefaultContextMenu();
this.element.component = null;
this.element = null;
this.menuContent = null;
}
How you can see here (like in other code) listner not removed from element!!!
That's why in second time show calls twice, for current context menu and for already
destroyed!
show: function(event, context) {
this.construct(context);
event.parameters = context;
var delayedMenu = new RichFaces.Menu.DelayedContextMenu(this.id +
"_menu", event);
window.setTimeout(delayedMenu.show, this.delay);
},
construct: function(context) {
if (this.isNewContext(context)) {
this.destroyMenu();
}
var div = document.createElement("div");
div.id = this.id + ":_auto_created";
div.style.zoom="1";
this.element.appendChild(div); <------------------- HERE FAILS
var html = this.evaluator.invoke('getContent',
context||{}).join('');
html = this.interpolate(html, context);
new Insertion.Top(div, html);
this.menuContent = div;
},
This is it.
Also I've try stopObservation in destroy. But it doesn't helps.
If surround problem code with
if (element){
}
context menu opens but if the mouse over context menu it give the same error.
Also while dynamic creation of menu handler are not destroyed.
Look at this issue, please.
It's needed for Exadel in Chicago...
=) May be some work around exist...
But I need to generete context menu inside the table.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira