From the Richfaces contextMenu Demo, we can see that a popup menu on an event on the target component. eg, click event, hover event, etc.
From the demo, we see only 1-level menu, we can further extend the contextMenu to 2-levels sub menu.
below are the code snippet extending the Richfaces contextMenu Demo
From the demo, we see only 1-level menu, we can further extend the contextMenu to 2-levels sub menu.
below are the code snippet extending the Richfaces contextMenu Demo
<
h:graphicImage
id
=
"pic"
library
=
"org.richfaces.showcase/img"
name
=
"pic1.jpg"
style
=
"border : 5px solid #E4EAEF"
/>
<
rich:contextMenu
target
=
"pic"
mode
=
"client"
showEvent
=
"click"
>
<
rich:menuItem
label
=
"Zoom In"
onclick
=
"enlarge(#{rich:element('pic')});"
/>
<
rich:menuItem
label
=
"Zoom Out"
onclick
=
"decrease(#{rich:element('pic')});"
/>
<
rich:menuGroup
label
=
"View"
>
<
rich:menuItem
label
=
"Detail"
onclick
=
"viewDetail(#{rich:element('pic')});"
/>
<
rich:menuItem
label
=
"Summary"
onclick
=
"viewSummary(#{rich:element('pic')});"
/>
</
rich:menuGroup
>
</
rich:contextMenu
>
With the help of <rich:menuGroup />, the contextMenu can further extends to a 2-levels sub menu.
and I found that, it is limited to 2 levels ONLY, if any reader of this post find a way to extend the contextMenu to more than 2 levels, please inform me as well.
No comments:
Post a Comment