I am using a <p:timeline> component in my project, with a <p:contextMenu> :
Code: Select all
<h:form id="form">
<p:timeline id="history" value="#{HistoryBean.timeline}"
editable="true" eventMargin="10"
eventMarginAxis="0" unselectable="true"
showNavigation="true" showButtonNean="true"
stackEvents="false" axisOnTop="true" >
<p:ajax event="select" listener="#{HistoryBean.onSelectEvent}" process=":form" />
</p:timeline>
<p:contextMenu for="history">
<p:menuitem value="Show details" action="#{HistoryBean.showEventDetails}" />
<p:menuitem value="Edit" action="#{HistoryBean.editEvent}" />
<p:menuitem value="Delete" action="#{HistoryBean.deleteEvent}" />
</p:contextMenu>
</h:form>
My goal is to select an event when right clicking, and having the <p:contextMenu> open only when right clicking on an event, not anywhere in the <p:timeline>.
In fact, I'm trying to achieve the same behavior as on a <p:dataTable> : the right click both selects the line, and opens the context menu.
I've naturally googled it, searched in the Primefaces documentation, but I haven't found anything about right clicking events in a timeline.
Any pointers as to how to tackle this challenge are welcome. Perhaps there's some way to access the Event components that are inside the timeline?
Primefaces : 6.2
JSF : 2.2
Server : Glassfish 4.0