-
1. Re: rich:contextMenu to put forward (z-Index)
siteburn Nov 25, 2011 3:49 AM (in response to siteburn)My first approach was:
rich:contextMenu - attributes:
- onexpand="document.body.appendChild(document.getElementById(#{rich:element('myContextMenuID')}.id)); document.getElementById(#{rich:element('myContextMenuID')}.id).style.zIndex = 10;"
- oncollapse="document.body.removeChild(document.getElementById(#{rich:element('myContextMenuID')}.id));"
It works, but it crashes with internal richfaces-scripts.
Could anybody help me with my problem?
Thanks, Siteburn
-
2. Re: rich:contextMenu to put forward (z-Index)
siteburn Dec 19, 2011 12:52 PM (in response to siteburn)My Solution:
<rich:contextMenu .... onexpand="contextMenuAtOpen(this.id, event);" oncollapse="contextMenuAtClose(this.id);" >....
JavaScript:
var contextParent;
//params: Element ID and Event
function contextMenuAtOpen(a, e) {
var elem = document.getElementById(a);
contextParent = elem.parentNode.id;
document.body.appendChild(elem);
elem.style.zIndex = 10;
elem.style.position = 'absolute';var windowHeight = document.body.clientHeight;
elem.style.display = 'block';
var elementHeight = elem.offsetHeight;if (e.pageY > windowHeight-elementHeight) {
elem.style.top = e.pageY-elementHeight + "px";
} else {
elem.style.top = e.pageY + "px";
}};
//params: Element ID
function contextMenuAtClose(a) {
var elem = document.getElementById(a);
document.getElementById(contextParent).appendChild(elem);
contextParent = null;
};