Hi!
I need some help with the context menu.
What I want is a file explorer, e.g. showing icons for PDF and Word files.
When you click on a file icon, a context menu should appear, showing the menu items
"Open" (to open the file via Servlet, e.g. /OutputServlet?filename=selectedFile) and
"Delete" to delete the file on the Server and rerender the file icons via Ajax
This is what I have so far. It shows the icons and calls a generic action method.
But I don't know how to select the current file for Open and to
rerender the form after deleting a file.
<h:form id="frmFiles" prependId="false">
<ui:repeat value="#{filesView.docFilenames}" var="doc">
<h:graphicImage id="imgDoc" name="images/word.jpg" alt="#{doc}" title="#{doc}"/>
<rich:contextMenu target="imgDoc" mode="client" showEvent="click">
<!-- Here I want to open the file #{doc} via a Servlet /OutputServlet?filename=#{doc} -->
<rich:menuItem label="Open" mode="ajax" action="#{filesView.openAction()}"/>
<!-- Here I need to delete the file and rerender this form -->
<rich:menuItem label="Delete" mode="ajax" action="#{filesView.deleteAction()}"/>
</rich:contextMenu>
</ui:repeat>
</h:form>
Thanks for listening.
Bernd