select event doesn't fire when right click on primefaces treenode - jsf

I have jsf page :
<p:contextMenu for="treeProfileSetEvent"
nodeType="PROFILESET">
<p:menuitem value="#{lang['common.button.add']}"
icon="ui-icon-plus"
update="#([id$=editPanel_event])"
actionListener="#{profileSetEventController.prepareAdd()}">
<f:setPropertyActionListener target="#{profileSetEventController.formStatus}" value="#{vpcrfConst.BTN_ADD}" />
</p:menuitem>
<p:menuitem value="#{lang['common.button.delete']}"
icon="ui-icon-close"
update="#([id$=btnPanel]) #([id$=treeProfileSetEvent]) #([id$=msgInfo])"
actionListener="#{profileSetEventController.prepareDelete()}"
oncomplete="PF('deleteDialog').show()">
<f:setPropertyActionListener target="#{profileSetEventController.formStatus}"
value="#{vpcrfConst.BTN_DELETE}" />
</p:menuitem>
</p:contextMenu>
<p:contextMenu for="treeProfileSetEvent"
nodeType="PARENT">
<p:menuitem value="#{lang['common.button.edit']}"
icon="ui-icon-pencil"
update="#([id$=editPanel_profileSetEvent])"
actionListener="#{profileSetEventController.prepareEdit()}">
<f:setPropertyActionListener target="#{profileSetEventController.formStatus}"
value="#{vpcrfConst.BTN_EDIT}" />
</p:menuitem>
<p:menuitem value="#{lang['common.button.delete']}"
icon="ui-icon-close"
update="#([id$=btnPanel]) #([id$=treeProfileSetEvent]) #([id$=msgInfo])"
actionListener="#{profileSetEventController.prepareDelete()}"
oncomplete="PF('deleteDialog').show()">
<f:setPropertyActionListener target="#{profileSetEventController.formStatus}"
value="#{vpcrfConst.BTN_DELETE}" />
</p:menuitem>
</p:contextMenu>
<p:contextMenu for="treeProfileSetEvent"
nodeType="PARENT_HAS_CHILD">
<p:menuitem value="#{lang['common.button.delete']}"
icon="ui-icon-close"
ajax="true"
update="#([id$=btnPanel]) #([id$=treeProfileSetEvent]) #([id$=msgInfo])"
actionListener="#{profileSetEventController.prepareDelete()}"
oncomplete="PF('deleteDialog').show()">
<f:setPropertyActionListener target="#{profileSetEventController.formStatus}"
value="#{vpcrfConst.BTN_DELETE}" />
</p:menuitem>
</p:contextMenu>
<p:contextMenu for="treeProfileSetEvent"
nodeType="CHILD">
<p:menuitem value="#{lang['common.button.edit']}"
icon="ui-icon-pencil"
update="#([id$=editPanel_profileSetEvent])"
actionListener="#{profileSetEventController.prepareEdit()}">
<f:setPropertyActionListener target="#{profileSetEventController.formStatus}"
value="#{vpcrfConst.BTN_EDIT}" />
</p:menuitem>
<p:menuitem value="#{lang['common.button.delete']}"
icon="ui-icon-close"
update="#([id$=btnPanel]) #([id$=treeProfileSetEvent]) #([id$=msgInfo])"
actionListener="#{profileSetEventController.prepareDelete()}"
oncomplete="PF('deleteDialog').show()">
<f:setPropertyActionListener target="#{profileSetEventController.formStatus}"
value="#{vpcrfConst.BTN_DELETE}" />
</p:menuitem>
</p:contextMenu>
<p:tree id="treeProfileSetEvent"
value="#{profileSetEventController.root}"
selection="#{profileSetEventController.selectedNode}"
dynamic="true"
selectionMode="single"
animate="true"
cache="true"
var="ps"
styleClass="vpcrf-tree-50pc">
<p:ajax event="select" listener="#{profileSetEventController.onNodeSelectListener}" update="#([id$=btnPanel]) #([id$=dlgProfileSetEvent])" />
<p:ajax event="expand" listener="#{profileSetEventController.onNodeExpandListener}" update="#([id$=btnPanel]) #([id$=dlgProfileSetEvent])" />
<p:treeNode id="parentNode"
icon="vpcrf-icon-profile"
type = "PROFILESET">
<h:outputText value="#{ps}" title="#{ps}"
styleClass="vpcrf-txt-400" />
</p:treeNode>
<p:treeNode id="eventParent" icon="vpcrf-icon-event-parent" type = "PARENT">
<h:outputText value="#{ps}" title="#{ps}"
styleClass="vpcrf-txt-400" />
</p:treeNode>
<p:treeNode id="eventParentHasChild" icon="vpcrf-icon-event-parent" type = "PARENT_HAS_CHILD">
<h:outputText value="#{ps}" title="#{ps}"
styleClass="vpcrf-txt-400" />
</p:treeNode>
<p:treeNode icon="vpcrf-icon-event-child" type = "CHILD">
<h:outputText value="#{ps}" title="#{ps}"
styleClass="vpcrf-txt-400" />
</p:treeNode>
</p:tree>
And the controller :
public void onNodeSelectListener(NodeSelectEvent e) {
try {
selectedNode = e.getTreeNode();
if (selectedNode.getData() instanceof ProfileSetDTO) {
selectedProfileSet = (ProfileSetDTO) selectedNode.getData();
} else {
event = (EventDTO) selectedNode.getData();
System.out.println(event.getEventName());
}
profileSet = null;
formStatus = Const.CLEAR;
} catch (Exception ex) {
reportError("msgInfo", "msg.error.unknown");
logger.error(ex, ex);
}
}
The problem is ajax event select only fire when I left-click on treenode, when right-click it doesn't work. Is there any way to make it work when I right-click on node ? Any help would be great.

On Primefaces 5.x (I'm using 5.1, but should work also on newer versions), you should be able to solve your issue by adding an ajax event related to contextMenu in the JSF page, as follows:
<p:ajax event="contextMenu" listener="#{profileSetEventController.onNodeSelectListener}" update="#([id$=btnPanel]) #([id$=dlgProfileSetEvent])" />
I tend to prefer this solution to the one already posted (the one that "overrides" the Primefaces onRightClick function) for three reasons.
First, there is no need to modify the Primefaces javascript (what if a newer version changes something about it? It's likely that, in this case, you have to modify your custom script!)
Second, you may want to separate the behavior of the listener onNodeSelectListener depending on which click (left or right) is fired by using e.isContextMenu() in the backing bean, so the controller may become something like:
public void onNodeSelectListener(NodeSelectEvent e) {
if (e.isContextMenu()) {
// right click has been fired
} else {
// left click has been fired
}
}
The second parameter true in this.selectNode(d, true) of the Primefaces script nodeRightClick serves exactly this purpose. In other words, by using this.selectNode(d) (as the overriding script does), it will be not possible to decide whether the listener has been invoked by a left or a right click.
Last, you may want to use a different listener (onRightClickSelectListener) for the two events (select and contextMenu) in the JSF page, as follows:
<p:ajax event="select" listener="#{profileSetEventController.onNodeSelectListener}" update="#([id$=btnPanel]) #([id$=dlgProfileSetEvent])" />
<p:ajax event="contextMenu" listener="#{profileSetEventController.onRightClickSelectListener}" update="#([id$=btnPanel]) #([id$=dlgProfileSetEvent])" />
and consequentely in the backing bean, as:
public void onNodeSelectListener(NodeSelectEvent e) {
// called when a select event occurs
}
public void onRightClickSelectListener(NodeSelectEvent e) {
// called when a contextMenu event occurs
}
Therefore using a contextMenu event only for the right click, instead of using select event for both clicks, may be a cleaner approach anyway.
Hope that helps.

I think you are facing the same problem I was having. I still don't get why this is working in the PrimeFaces showcase, but I was able to fix it by replacing PrimeFaces' nodeRightClick handler (JavaScript):
PrimeFaces.widget.BaseTree.prototype.nodeRightClick = function(e, a) {
PrimeFaces.clearSelection();
if ($(e.target).is(":not(.ui-tree-toggler)")) {
var d = a.parent(), b = a.hasClass("ui-tree-selectable");
if (b && this.cfg.selectionMode) {
var c = this.isNodeSelected(d);
if (!c) {
if (this.isCheckboxSelection()) {
this.toggleCheckboxNode(d)
} else {
this.unselectAllNodes();
// Fixed right click selecting
// original code: this.selectNode(d, true)
this.selectNode(d); // <-- Fix
}
}
this.fireContextMenuEvent(d)
}
}
}

Related

Create edit form for Primefaces table

I want to create edit form for Primefaces table. I tested this code:
<h:form id="form">
<p:dataTable id="tbl" var="systemuser" value="#{systemusers.systemUsers}"
selectionMode="single" selection="#{systemusers.selectedSystemUser}" rowKey="#{systemuser.username}" lazy="true"
resizableColumns="true"
>
<p:ajax event="rowSelect" listener="#{systemusers.onRowSelect}" update=":form:carDetail" oncomplete="PF('carDialog').show()" />
....................
</p:dataTable>
<p:dialog id="wd" header="System User Details" widgetVar="carDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="true">
<p:outputPanel id="carDetail" style="text-align:center;">
<p:panelGrid columns="2" columnClasses="label,value">
<h:outputLabel for="id" value="ID" />
<p:outputLabel id="id" value="#{systemusers.selectedSystemUser.id}" rendered="#{not systemusers.editable}"/>
<h:inputText value="#{systemusers.selectedSystemUser.id}" rendered="#{systemusers.editable}" />
........
</p:panelGrid>
</p:outputPanel>
<f:facet name="footer">
<p:commandButton value="Edit System User" rendered="#{not systemusers.editable}"
actionListener="#{systemusers.editRecord(false)}">
<f:ajax render=":form:wd" execute=":form:wd"></f:ajax>
</p:commandButton>
<p:commandButton value="Cancel" rendered="#{systemusers.editable}" actionListener="#{systemusers.editRecord(true)}">
<f:ajax render=":form" execute=":form"></f:ajax>
</p:commandButton>
</f:facet>
</p:dialog>
<p:contextMenu for="tbl">
<p:menuitem value="View" update="carDetail" icon="fa fa-search" oncomplete="PF('carDialog').show()"/>
<p:menuitem value="Delete" update="tbl" icon="fa fa-remove" actionListener="#{systemusers.deleteSystemUser}">
<p:confirm header="Confirmation" message="Are you sure?" icon="fa fa-warning" />
</p:menuitem>
</p:contextMenu>
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
<p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="fa fa-check" />
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="fa fa-remove" />
</p:confirmDialog>
</h:form>
Managed bean:
#Named
#RequestScoped
public class Systemusers implements Serializable
{
.......
public void editRecord(boolean editable)
{
SessionFactory factory = HibernateUtils.getSessionFactory();
Session session = factory.getCurrentSession();
try
{
session.getTransaction().begin();
SystemUsersModel obj = new SystemUsersModel();
obj.setId(selectedSystemUser.getId());
..........
session.update(obj);
session.getTransaction().commit();
this.editable = editable;
}
catch (Exception e)
{
e.printStackTrace();
session.getTransaction().rollback();
}
}
......
private boolean editable = false;
public boolean isEditable()
{
return editable;
}
public void setEditable(boolean editable)
{
this.editable = editable;
}
}
When I open the Edit form and I click button Edit System User the form disappears. Probably because I render and execute it. How I can execute the form and under it without closing it?
The example code is bad in multiple ways. Two things stand out:
It is not an [mcve]
<f:ajax render=":form" execute=":form"> is superfluous or might even cause the weird behaviour
OP most likely does not know that (quote from the PrimeFaces showcase , emphasis mine)
CommandButton
CommandButton extends the standard h:commandButton with ajax, partial processing and skinning features.
So the commandBotton is already ajax anabled and does not need to hava a
<f:ajax render=":form" execute=":form">
inside it. This (most likely) makes an the update run twice. One #none (Understanding PrimeFaces process/update and JSF f:ajax execute/render attributes) and one updating the form. The second one most likely does not have any content. But trying (and debugging) will make things clear. If this is not the answer, the reason cannot be seen in the code and hence it should have been a [mcve]

Creating master-detail table and dialog, how to reuse same dialog for create and edit

I am attempting to create a dialog that will serve the purpose of both creating objects and updating them. So if I happen to click the 'new' button I will be presented a dialog containing empty fields to be filled or if I click on an edit button for an entry, that entry's data will presented in the dialog for update.
Following the example in the primefaces showcase for version 5.2, I can present the data in a read only outputText form, however when I change it to an inputText, the field remains empty. The following code is an example of what I have:
<h:form id="form">
<p:dataGrid id="guestList" var="guest" value="${guestList.guests}" columns="3" paginator="true" rows="20">
<f:facet name="header">
Guest List
</f:facet>
<p:panel>
<h:outputText value="${guest.name}" />
<br />
<h:outputText value="${guest.street}" />
<br />
<h:outputText rendered="#{guest.street2.length() gt 0}"
value="${guest.street2}" />
<h:panelGroup rendered="#{guest.street2.length() gt 0}">
<br />
</h:panelGroup>
<h:outputText value="${guest.city}, " />
<h:outputText value="${guest.state} " />
<h:outputText value="${guest.zipCode}" />
<p:commandButton update="#form:newGuestDetail" oncomplete="PF('newGuestDialog').show()" icon="ui-icon-edit" styleClass="ui-btn-inline">
<h:outputText styleClass="ui-icon ui-icon-edit" style="margin:0 auto;" />
<f:setPropertyActionListener value="#{guest}" target="#{guestList.selectedGuest}" />
</p:commandButton>
</p:panel>
</p:dataGrid>
<p:dialog header="#{guestList.hasSelected() ? 'Edit Guest' : 'New Guest'}" widgetVar="newGuestDialog" modal="true" showEffect="fade" hideEffect="fade">
<p:outputPanel id="newGuestDetail">
<h:outputText value="'#{guestList.selectedGuest.name}'"/>
<p:inputText id="guestName" value="#{guestList.hasSelected() ? '' : guestList.selectedGuest.name}" pt:placeholder="Name"/>
<p:commandButton value="#{guestList.selectedGuest == null ? 'Create Guest' : 'Update Guest'}"/>
</p:outputPanel>
</p:dialog>
</h:form>
The hasSelected() method evaluates whether the selected guest is null or not, returning true if not null. The selectedGuest should be set when the commandButton is clicked so that an object is available for retrieval by the dialog, however, with tracers in the get/set for selectedGuest, I am not seeing the setter called with the above snippet. If I remove the inputText, then even though the hasSelected is still returning false, and thus the 'New Guest' is heading the dialog, the outputText is filled with a value.
I found this great post talking about the order of execution with respect to the action, action listener, etc., but don't think this quite my issue: Differences between action and actionListener.
So the ultimate question is why will my setter get called with the command button when I only have an outputText, but with an inputText, I never see it called in the log?
I appreciate the time and help anyone can provide.
Even if we fix your problem, this construct
<p:inputText value="#{guestList.hasSelected() ? '' : guestList.selectedGuest.name}">
is not ever going to work. It needs to reference a model property, not an empty string.
You'd best just reuse the edit form and let the create button precreate an empty entity. This would simplify a lot in the view side. It'd be more easy if the entity has an #Id property which is only present when it's persisted in the database.
Here's a kickoff example:
<h:form id="entitiesForm">
<p:dataTable id="entitiesTable" value="#{bean.entities}" var="entity">
<p:column>#{entity.foo}</p:column>
<p:column>#{entity.bar}</p:column>
<p:column>
<p:commandButton id="edit" value="Edit"
process="#this" action="#{bean.edit(entity)}"
update=":entityDialog" oncomplete="PF('entityDialog').show()" />
<p:commandButton id="delete" value="Delete"
process="#this" action="#{bean.delete(entity)}"
update=":entitiesForm:entitiesTable" />
</p:column>
</p:dataTable>
<p:commandButton id="add" value="Add"
process="#this" action="#{bean.add}"
update=":entityDialog" oncomplete="PF('entityDialog').show()" />
</h:form>
<p:dialog id="entityDialog" widgetVar="entityDialog"
header="#{empty bean.entity.id ? 'New' : 'Edit'} entity">
<h:form id="entityForm">
<p:inputText id="foo" value="#{bean.entity.foo}" />
<p:inputText id="bar" value="#{bean.entity.bar}" />
<p:commandButton id="save" value="#{empty bean.entity.id ? 'Create' : 'Update'} entity"
process="#form" action="#{bean.save}"
update=":entitiesForm:entitiesTable" oncomplete="PF('entityDialog').hide()" />
</h:form>
</p:dialog>
With this #ViewScoped bean:
private List<Entity> entities; // +getter
private Entity entity; // +getter
#EJB
private EntityService entityService;
#PostConstruct
public void load() {
entities = entityService.list();
entity = null;
}
public void add() {
entity = new Entity();
}
public void edit(Entity entity) {
this.entity = entity;
}
public void save() {
entityService.save(entity); // if (id==null) em.persist() else em.merge()
load();
}
public void delete(Entity entity) {
entityService.delete(entity); // em.remove(em.find(type, id))
load();
}
See also:
Creating master-detail pages for entities, how to link them and which bean scope to choose
Keep p:dialog open when a validation error occurs after submit

primefaces datatable selected row always the same value

I have a datatable with custom delete button when I try to send the id of the selected row to the backing bean, but i always get the same value, this is my code:
<p:dataTable id="result" var="service" value="#{bean.services}" editable="true">
<!-- ajax -->
<p:ajax event="rowEdit" listener="#{bean.onEdit}" update=":form:msg" />
<p:ajax event="rowEditCancel" listener="#{bean.onCancel}" update=":form:msg" />
.....
<p:column headerText="delete" style="width:100px;">
<p:confirmDialog id="confirmation" message="are u sure?" header="delete item" widgetVar="confirmation" showEffect="fade" hideEffect="explode">
<p:commandButton value="Yes" onclick="PF('confirmation').hide()" actionListener="#{bean.onDeleteRow}">
<f:setPropertyActionListener target="#{bean.cve}" value="#{service.id.cve}" />
</p:commandButton>
<p:commandButton value="No" onclick="PF('confirmation').hide()" type="button" />
</p:confirmDialog>
<p:commandLink id="deleteLink" onclick="PF('confirmation').show()" styleClass="ui-icon ui-icon-trash"/>
</p:column>
</p:dataTable>
here is the baking bean code:
#ManagedBean
#ViewScoped
#SuppressWarnings("serial")
public class Bean implements Serializable{
private String cve;
...
public void setcve(String cve) {
this.cve = cve;
}
....
public void onDeleteRow(){
try {
System.out.println("delete-->" + this.cve );
} catch (Exception e) {
e.printStackTrace();
}
}
}
In the tag you can see the value that I'm sending as a parameter but I always leave the last value of datatable ...
What am I doing wrong?
Thank you very much for the support
Also there is another problem in your code, you have and Dialog for each row in the datatable, its a bad idea... you should keep the button on the row and set the entity that you want to delete when click at this button and latter just show the dialog, which is just one... something like this: also, change the propertyAcionListener to your delete link
<p:commandLink id="delete_link" oncomplete="deleteDlg.show();">
Delete
<f:setPropertyActionListener value="#{service.id.cve}" target="#{bean.cve}" />
</p:commandLink>
Where is the selection for datatable?
your xhtml
<p:dataTable id="result" var="service" value="#{bean.services}" editable="true">
must be xhtml
<p:dataTable id="result" var="service" value="#{bean.services}" selection="#{bean.selected}" editable="true">
you can find datatable selection example here

navigation by action for p:menuitem doesn't work

I am currently using PrimeFaces 5.
I have this method in a bean called home:
public String panelSearch() {
pnlsearch = true;
return "home";
}
pnlsearch is a property that makes a panel visible
home.xhtml contains:
<p:menubar>
<p:menuitem id="mnusearch"
value="Search"
ajax="true"
action="#{home.panelSearch}"
icon="ui-icon-search" />
<p:menuitem value="Search" >
<p:commandLink ajax="false"
action="#{home.panelSearch}"
value="Search" />
</p:menuitem>
</p:menubar>
<h:panelGrid rendered="#{home.pnlsearch}">...</h:panelGrid>
panelSearch is called with action in both p:menuitem and in p:commandLink
but panelSearch is visible only with p:commandLink
Why panelSearch is not made visible with a click on p:menuitem alone as well?
note: p:commandLink is called no matter the navigation-rule in faces-config.xml

Primefaces, Menuitem ActionListener on Right Click

i'm having some questions here. I will appreciate all of your helps.
I'm making some dynamic multilevel menu in primefaces, and i did it. There are parents, sub menus, and the menu items.
I want to give some CRUD action for each component via context menu, so I can edit the value/text for each level just with right-click.
I make the menu with bean called MenussBean.java, and you can see it below (just the correspond code).
public Submenu subMenus(Submenu parentMenus,String i, int id)
{
if(i==""&&parentMenus==null)
{
subList = menusdao.getRootMenu();
for(int a=0;a<subList.size();a++){
parentMenus = new Submenu();
parentMenus.setLabel(subList.get(a).getMenu());
model.addSubmenu(parentMenus);
i=subList.get(a).getMenu();
subMen = null;
id = a+1;
subList2 = subKategori(id);
for(Menus k:subList2){
if(String.valueOf(parentMenus.getLabel().toString()).equals(i)){
subMen = new Submenu();
subMen.setId("_"+k.getId());
subMen.setLabel(k.getMenu());
parentMenus.getChildren().add(subMen);
subMenus(subMen,k.getMenu(),k.getId());
}
}
}
}else{
subMen = null;
subList2 = subKategori(id);
for(Menus k:subList2){
if(String.valueOf(parentMenus.getLabel().toString()).equals(i)){
subList3=subKategori(k.getId());
if(subList3.size()==0)
{
UIParameter uiParam = new UIParameter();
UIParameter menuParam = new UIParameter();
UIParameter idParentParam = new UIParameter();
uiParam.setName("idParam");
uiParam.setValue(k.getId());
menuParam.setName("menuParam");
menuParam.setValue(k.getMenu());
idParentParam.setName("idParentParam");
idParentParam.setValue(k.getId_parent());
MenuItem mi = new MenuItem();
mi.setId("_"+k.getId());
Application app = FacesContext.getCurrentInstance().getApplication();
MethodExpression methodExpr = app.getExpressionFactory().createMethodExpression
(FacesContext.getCurrentInstance().getELContext(), "#{menussBean.onItemClick}", null ,new Class[]{ javax.faces.event.ActionEvent.class});
mi.addActionListener(new MethodExpressionActionListener(methodExpr));
mi.setOncomplete("");
mi.setValue(k.getMenu());
mi.setTarget("_self");
mi.setTitle(k.getLink());
mi.setAjax(false);
mi.getChildren().add(uiParam);
mi.getChildren().add(menuParam);
mi.getChildren().add(idParentParam);
mi.setProcess("#all");
parentMenus.getChildren().add(mi);
}
else if (subList3.size()!=0)
{
subMen = new Submenu();
subMen.setId("_"+k.getId());
subMen.setLabel(k.getMenu());
parentMenus.getChildren().add(subMen);
subMenus(subMen,k.getMenu(),k.getId());
}
}
}
}
return parentMenus;
}
public List<Menus> subKategori(int i)
{
arayList=new ArrayList<Menus>();
for(Menus k:getList()){
if(k.getId_parent()==i){
arayList.add(k);
}
}
return arayList;
}
public static List<Menus> getList() {
return list;
}
This is the value-getter method:
public void onItemClick() {
FacesContext context = FacesContext.getCurrentInstance();
idItem = context.getExternalContext().getRequestParameterMap().get("idParam");
menuItem = context.getExternalContext().getRequestParameterMap().get("menuParam");
idParentItem = context.getExternalContext().getRequestParameterMap().get("idParentParam");
}
And I want to use context menu to give the CRUD operations, so the user can right-click on the component he wants to edit. Here is my xhtml files.
<h:form>
<p:panelMenu id="panel" style="width:400px;font-size:12px"
model="#{menussBean.model}" var="detail" selectionMode="single" ajax="true"
widgetVar = "panelMen" styleClass="myMeineClass">
</p:panelMenu>
<p:contextMenu for="panel" style="font-size:12px">
<p:menuitem value="View" icon="ui-icon-search"
oncomplete="menuDialog.show()" update="display">
<f:param name="id_barangbaru" value="#{detail}" />
</p:menuitem>
<p:menuitem value="Add" icon="ui-icon-plus" />
<p:menuitem value="Edit" icon="ui-icon-pencil" />
<p:menuitem value="Delete" icon="ui-icon-close" />
</p:contextMenu>
<p:dialog header="Menu Detail" widgetVar="menuDialog"
resizable="false" width="200" showEffect="clip" hideEffect="fold"
id="dialog" appendToBody="true" modal="true">
<h:panelGrid id="display" columns="2" cellpadding="4" style="font-size:12px">
<h:outputText value="ID:" />
<h:outputText value="#{menussBean.idItem}"
style="font-weight:bold" />
<h:outputText value="Label:" />
<h:outputText value="#{menussBean.menuItem}"
style="font-weight:bold" />
<h:outputText value="Parent:" />
<h:outputText value="#{menussBean.idParentItem}"
style="font-weight:bold" />
</h:panelGrid>
</p:dialog>
</h:form>
Right now, I'm still getting the value into the context menu output text, but it needs to be left-clicked first. I need to pass the value directly just with right-click.
So, how can I get the value with actionListener with right-click? Please help...
I want to show the screenshot but I'm new here, so I haven't got any reputation.

Resources