Greetings!
I have a menu component that opens when an image is clicked...
dojo.declare("ToolbarMenuButton", null, {
constructor: function(menuId,overImgSrc){
this._overImgSrc = overImgSrc;
this._menuId = menuId;
},
showMenu: function(event){
// Get the object from the event
var _btn = window.event ? window.event.srcElement :
event ? event.target : null;
_btn.setProps( {src : '#{
facesContext.externalContext.requestContextPath}' +this._overImgSrc} );
// Get the menu based on its id and open
var menu = dojo.byId(this._menuId);
menu.open(event);
}
})
<webuijsf:script>
var toolbarMenuBtn_#{btnIndex} = new ToolbarMenuButton(
"menu_#{btnIndex}", "#{button.imageOverSource}" )
</webuijsf:script>
<webuijsf:image
url="#{button.imageOffSource}"
tabIndex="#{btnIndex}"
id="btn_#{btnIndex}"
toolTip="#{button.toolTip}"
onClick="toolbarMenuBtn_#{btnIndex}.showMenu(event)"/>
<mycomp:menu
id="menu_#{btnIndex}"
items="#{button.options}"
eventListenerExpression="#{button.submitMenuAction}"
submitForm="true"/>
The menu works beautfully (note: we created a custom facelets tag handler to
get facelets to support 'eventListenerExpression' attr, hence the "mycomp"
namespace wrapping the webuijsf menu component).
Only one issue, if the user resizes the window, the menu opens where it was
originally positioned on the screen, not according to where the event source
(the image) is located following the window resize.
This feels like a bug to me. Any thoughts?
Thanks!
Jason