I am using jsf 2.0 and primeface 3.5;
i am displaying a datatable and on the selection of any row, i display details in dailogue box. now the problem is when the page is loaded, and for the first time i select any row , the dialogue display nothing, but after that it works properly, what can be the reason of this issue
<h:body>
<h:form id="form">
<p:dataTable var="row"
value="#{user.list}" paginator="true"
rows="10" selection="#{user.selectedUser}"
filteredValue="#{user.filteredUser}" rowKey="#{row.attackID}"
rowsPerPageTemplate="5,10,15" selectionMode="single" paginatorPosition="bottom">
<p:ajax event="rowSelect" update=":form:display"
oncomplete="dlg.show()" listener="#{user.selected()}"/>
<p:column headerText="User-ID" filterBy="#{row.userID}">
<h:outputText value="#{row.userID}" />
</p:column>
<p:column headerText="Name" filterBy="#{row.userName}">
<h:outputText value="#{row.userName}" />
</p:column>
<p:column headerText="Threat" filterBy="#{row.attackID}">
<h:outputText value="#{row.attackID}" />
</p:column>
<p:column headerText="Rank">
<h:outputText value="#{row.rank}" />
</p:column>
</p:dataTable>
<p:dialog id="tDialog" header="Threat info" widgetVar="dlg"
modal="true" height="250" width="300" showEffect="explode"
hideEffect="explode">
<h:panelGrid id="display" columns="2" cellpadding="4">
<h:outputText value="Attack ID:" />
<h:outputText value="#{user.selectedUser.attackID} " />
<h:outputText value="Name:" />
<h:outputText value="#{user.selectedUser.attackName}" />
<h:outputText value="Action Taken:" />
<h:outputText value="#{user.selectedUser.actionTaken}" />
<h:outputText value="Attack Time:" />
<h:outputText value="#{user.selectedUser.attackTime }" />
</h:panelGrid>
</p:dialog>
</h:form>
</h:body>
Related
I am using PrimeFaces 5. Trying to learn it.
I am working on this particular screen for almost 3 days and had no progress.
I read the showcase of Primefaces lots of times, but everything seems to be in order. It is possible that I am addicted to my code and can not see the answer, but it seems to be all liked because it is all associated with events, or so it seems.
Problems:
- My DropDown (selectOneMenu) does not respond to click events to show its options;
- The arrows that do the paging of my search results does not respond to click as well;
- The search button does not respond after the first search;
- The View buttons does not displays the dialog;
- The growl component is also not recieving updates;
I am supplying the link to download the sourcecode here
- https://dl.dropboxusercontent.com/u/5784798/par.7z
Here it is the form working
<h:form id="formularioResultadoUsuario">
<p:dataTable var="usuario"
value="#{adiminstraUsuarioView.lazyUsuarioDataModel}"
paginator="true" rows="10"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10,15" rowKey="#{usuario.id}"
selectionMode="single"
selection="#{adiminstraUsuarioView.selectedUsuario}"
id="usuarioTable" lazy="true">
<p:ajax event="rowSelect"
listener="#{adiminstraUsuarioView.onRowSelect}"
update=":formularioResultadoUsuario:usuarioDetail"
oncomplete="PF('usuarioDialog').show()" />
<p:column headerText="Id" sortBy="#{usuario.id}"
filterBy="#{usuario.id}">
<h:outputText value="#{usuario.id}" />
</p:column>
<p:column headerText="Nome" sortBy="#{usuario.nome}"
filterBy="#{usuario.nome}">
<h:outputText value="#{usuario.nome}" />
</p:column>
<p:column headerText="Grupo" sortBy="#{usuario.grupo}"
filterBy="#{usuario.grupo}">
<h:outputText value="#{usuario.grupo}" />
</p:column>
<p:column headerText="Role" sortBy="#{usuario.role}"
filterBy="#{usuario.role}">
<h:outputText value="#{usuario.role}" />
</p:column>
<p:column headerText="Sistema" sortBy="#{usuario.sistema}"
filterBy="#{usuario.sistema}">
<h:outputText value="#{usuario.sistema}" />
</p:column>
<p:column headerText="Subsistema" sortBy="#{usuario.subsistema}"
filterBy="#{usuario.subsistema}">
<h:outputText value="#{usuario.subsistema}" />
</p:column>
</p:dataTable>
<p:dialog header="Car Detail" widgetVar="usuarioDialog" modal="true"
showEffect="fade" hideEffect="fade" resizable="false">
<p:outputPanel id="usuarioDetail" style="text-align:center;">
<p:panelGrid columns="2"
rendered="#{not empty adiminstraUsuarioView.selectedUsuario}"
columnClasses="label,value">
<h:outputText value="Id:" />
<h:outputText value="#{adiminstraUsuarioView.selectedUsuario.id}" />
<h:outputText value="Nome" />
<h:outputText
value="#{adiminstraUsuarioView.selectedUsuario.nome}" />
<h:outputText value="Grupo:" />
<h:outputText
value="#{adiminstraUsuarioView.selectedUsuario.grupo}" />
<h:outputText value="Role:" />
<h:outputText
value="#{adiminstraUsuarioView.selectedUsuario.role}" />
<h:outputText value="Sistema:" />
<h:outputText
value="#{adiminstraUsuarioView.selectedUsuario.sistema}" />
<h:outputText value="Subsistema:" />
<h:outputText
value="#{adiminstraUsuarioView.selectedUsuario.subsistema}" />
</p:panelGrid>
</p:outputPanel>
</p:dialog>
</h:form>
I need your help on JSF2. I made a datatable to list data items from database. I want to select an item from that list an print it on an edit dialog. The problem is that the item's data is'nt shown on that dialog. Here is JSF code used to generate it:
<p:dataTable value="#{airportController.items}" var="item" style="border: 0px;">
<f:facet name="header">Airports</f:facet>
<p:column>
<f:facet name="header">ID</f:facet>
<h:outputText value="#{item.airportId}"/>
</p:column>
<p:column>
<f:facet name="header"></f:facet>
<p:commandButton title="View" value="" update=":airportForm:airportEditForm" icon="edit_icon.gif"oncomplete="editAirportDlg.show();">
<f:setPropertyActionListener value="#{item}" target="#{airportController.selected}"/>
</p:commandButton>
</p:column>
<p:commandButton value="Ajouter" onclick="createAirportDgl.show();"/>
</p:dataTable>
<p:dialog id="airportEditForm" widgetVar="editAirportDlg" modal="false" header="Modifier" rendered="true" resizable="false">
<h:panelGrid id="airportDisplay" columns="2" paginator="true" rows="10" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,15">
<h:outputText value="Pays"/>
<p:inputText value="#{airportController.selected.country}"/>
<h:outputText value="Ville"/>
<p:inputText value="#{airportController.selected.city}"/>
<h:outputText value="Nom"/>
<p:inputText value="#{airportController.selected.name}"/>
<h:outputText value="Addresse"/>
<p:inputText value="#{airportController.selected.hqAddress}"/>
<p:commandButton value="Valider" action="#{airportController.update()}"/>
</h:panelGrid>
</p:dialog>
All that is put all together in the index.xhtml page.
I don't know what i did wrong.
Could you send the whole xhtml content? This could be a validation problem. Try to use process="#this" on the commandButton and update the airportDisplay instead.
<p:commandButton title="View" value=""
update=":airportForm:airportDisplay"
icon="edit_icon.gif"oncomplete="editAirportDlg.show();" process="#this">
<f:setPropertyActionListener value="#{item}" target="#{airportController.selected}"/>
</p:commandButton>
Try to put everything i.e your datatable and dialog inside h:form with id and then
on edit button click update your dialog with respect to grid id like :form:airportDisplay also shown in below.
<h:form id="form">
<p:growl id="growl" showDetail="true" life="3000"/>
<p:dataTable value="#{airportController.items}" var="item" style="border: 0px;">
<f:facet name="header">Airports</f:facet>
<p:column>
<f:facet name="header">ID</f:facet>
<h:outputText value="#{item.airportId}"/>
</p:column>
<p:column>
<f:facet name="header"></f:facet>
<p:commandButton title="View" value="" update=":form:airportDisplay" icon="edit_icon.gif"oncomplete="editAirportDlg.show();">
<f:setPropertyActionListener value="#{item}" target="#{airportController.selected}"/>
</p:commandButton>
</p:column>
<p:commandButton value="Ajouter" onclick="createAirportDgl.show();"/>
</p:dataTable>
<p:dialog id="airportEditForm" widgetVar="editAirportDlg" modal="false" header="Modifier" rendered="true" resizable="false">
<h:panelGrid id="airportDisplay" columns="2" paginator="true" rows="10" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,15">
<h:outputText value="Pays"/>
<p:inputText value="#{airportController.selected.country}"/>
<h:outputText value="Ville"/>
<p:inputText value="#{airportController.selected.city}"/>
<h:outputText value="Nom"/>
<p:inputText value="#{airportController.selected.name}"/>
<h:outputText value="Addresse"/>
<p:inputText value="#{airportController.selected.hqAddress}"/>
<p:commandButton value="Valider" action="#{airportController.update()}"/>
</h:panelGrid>
</p:dialog>
</h:form>
Thanks for help, here is page content,
index.xhtml
<ui:define name="title">
Airports
</ui:define>
<ui:define name="header">
header
</ui:define>
<ui:define name="menu">
menu
</ui:define>
<ui:define name="content">
<h:form id="airportForm">
<ui:include src="list.xhtml"/>
<ui:include src="edit.xhtml"/>
<ui:include src="create.xhtml"/>
</h:form>
</ui:define> </ui:composition>
list.xhtml
<p:dataTable value="#{airportController.items}" var="item" style="border: 0px;" >paginator="true"
rowKey="#{item.airportId}" selection="#{airportController.selected}" >selectionMode="single"
sortBy="#{item.airportId}">
Airports
ID
Nom
Pays
Ville
Addesse
onclick="editAirportDlg.show();"/>
update=":airportForm:airportCreateForm"
onclick="createAirportDgl.show();"/>
edit.xhtml
<p:dialog widgetVar="editAirportDlg" modal="false"
header="Modifier" rendered="true" resizable="false">
<h:form id="airportEditForm">
<h:panelGrid columns="2">
<h:outputText value="Pays :"/>
<p:inputText value="#{airportController.selected.country}"/>
<h:outputText value="Ville: "/>
<p:inputText value="#{airportController.selected.city}"/>
<h:outputText value="Nom: "/>
<p:inputText value="#{airportController.selected.name}"/>
<h:outputText value="Addresse: "/>
<p:inputText value="#{airportController.selected.hqAddress}"/>
<f:facet name="footer">
<p:commandButton value="Valider" icon="ui-icon-disk" action=" {airportController.update()}"/>
</f:facet>
</h:panelGrid>
</h:form>
</p:dialog> </ui:composition>
Hi i need to create a accordian panel with a datatable inside the tab1 but i am geeting the following error:: javax.Servlet.ServletException:cannot find component with identifier ":form:display" ,can anyone plz help me out to resolve this error using primefaces.i need to work without using widgets.
view.xhtml
<h:form prependId="false" id="form">
<p:dataTable id="dataTable" var="car" value="#{tableBean.getList()}"
paginator="true" rows="10" selectionMode="single" selection="#{tableBean.selectedCar}" rowKey="#{car.model}"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="5,10,15">
<f:facet name="header">
Posted Jobs
</f:facet>
<p:column>
<f:facet name="header">
<h:outputText value="Model" />
</f:facet>
<h:outputText value="#{car.model}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Year" />
</f:facet>
<h:outputText value="#{car.year}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Manufacturer" />
</f:facet>
<h:outputText value="#{car.manufacturer}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Color" />
</f:facet>
<h:outputText value="#{car.color}" />
</p:column>
<f:facet name="footer">
<p:commandButton id="viewButton" value="View" icon="ui-icon-search"
update=":form:display" oncomplete="carDialog.show()" actionListener="#{tableBean.add}"
/>
</f:facet>
</p:dataTable>
<p:dialog id="dialog" header="Car Detail" widgetVar="carDialog" resizable="false"
width="200" showEffect="clip" hideEffect="fold">
<h:panelGrid id="display" columns="2" cellpadding="4">
<h:outputText value="Model:" />
<h:outputText value="#{tableBean.selectedCar.model}" />
<h:outputText value="Year:" />
<h:outputText value="#{tableBean.selectedCar.year}" />
<h:outputText value="Manufacturer:" />
<h:outputText value="#{tableBean.selectedCar.manufacturer}" />
<h:outputText value="Color:" />
<h:outputText value="#{tableBean.selectedCar.color}" />
</h:panelGrid>
</p:dialog>
</h:form>
AccordionPanel.xhtml
<h:head>
<title>Accordion Panel</title>
</h:head>
<h:body>
<h:form>
<p:accordionPanel>
<p:tab id="DataTable1" title="DataTable 1">
<ui:include src="view.xhtml" />
</p:tab>
<p:tab id="DataTable2" title="DataTable2">
</p:tab>
</p:accordionPanel>
</h:form>
</h:body>
</html>
You are getting this error because the update target of your commandButton can not be found using the specified component reference on the rendered html.
<p:commandButton id="viewButton" value="View" icon="ui-icon-search"
update=":form:display" oncomplete="carDialog.show()" actionListener="#tableBean.add}"/>
Try removing the update=":form:display" so that your page can render, check the generated component id of the display panelGrid with Firebug and use that id in your update target.
Since primefaces version 3.1 component referencing is aligned with the JSF Spec. See this link for further information UI Component findComponent()
update your (update=":form:display") attribute on commandButton to this :
update=":form:dialog:display"
I am Using
WebSphere Application Server 7.0.0.25,
Myfaces 2.0.7,
Primefaces 3.4.1
I have the following page which is using p:tabView has 3 tabs
dashboard.xhtml
Dashboard is main page which has header.xhtml. and first tab has 4 radio buttons. on clicking of each radio button would load different code piece written in ui:composite using AJAX.
Second tabs has some buttons in footer of the p:dataTable. When I click on the button a dialog will show up the selected row in the datatable.
I see the following error in server logs.
Error Rendering View[/dashboard.xhtml]
javax.faces.FacesException: Cannot find component with identifier ":tabView:panelGridNewUserDialog" referenced from "tabView:userList:addUserButton".
But when I see "View Source" in browser, HTML code is incomplete. I have put the p:dialog tags bottom of the AppUserManagement.xhtml. All that code is not rendered as HTML. And commandButton is not showing in dataTable footer
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui">
<c:set var="webCtxRoot" value="#{request.contextPath}" />
<f:view locale="#{language.locale}">
<h:head>
<link rel="stylesheet" type="text/css"
href="#{webCtxRoot}/theme/ldapmanager.css" />
<title>Welcome To Ldap Manager Application</title>
<h:outputScript name="jsf.js" library="javax.faces" id="script_id" />
</h:head>
<h:body>
<h:form id="headerForm" prependId="false">
<h:inputHidden value="#{authenticatedBackingBean.session}"
id="sessionValidator" />
<ui:include src="header.xhtml" />
<p:spacer height="8" width="160" />
<p:tabView id="tabView" dynamic="true" cache="true">
<p:tab id="applicationUserManagementTab"
title="Application User Mgmt">
<ui:include src="AppUserManagement.xhtml" />
</p:tab>
<p:tab id="userManagementTab" title="User Management">
<p:panelGrid id="dashboardContentGrid" styleClass="panelDiv">
<p:row>
<p:column>
<p:panelGrid>
<p:row>
<p:column>
<p:fieldset legend="Choose User Operation" id="buttonPanel">
<p:selectOneRadio id="userOperationType"
value="#{userAct.userAction}">
<f:selectItem id="newUser" itemLabel="New User"
itemValue="UMNewUser" />
<f:selectItem id="modifyUser" itemLabel="Modify User"
itemValue="UMModifyUser" />
<f:selectItem id="deleteUser" itemLabel="Delete User"
itemValue="UMDeleteUser" />
<f:selectItem id="modifyPassword"
itemLabel="Change / Reset Password"
itemValue="UMModifyPassword" />
<p:ajax update="ContentPanel"
listener="#{userAct.returnSelectedValue}" />
</p:selectOneRadio>
</p:fieldset>
</p:column>
</p:row>
<p:row>
<p:column>
<p:growl id="growl" showDetail="true" life="20000"
autoUpdate="true" />
<p:outputPanel id="ContentPanel" layout="block">
<ui:include src="#{userAct.userAction}.xhtml" />
</p:outputPanel>
</p:column>
</p:row>
</p:panelGrid>
</p:column>
<p:column>
<p:outputPanel id="helpPanel">
<p:inputTextarea id="helpWindow" rows="18" cols="80"
value="Move your mouse over various fields for instant help" />
</p:outputPanel>
</p:column>
</p:row>
</p:panelGrid>
</p:tab>
<p:tab id="userGroupManagementTab" title="User Group Mgmt">
</p:tab>
</p:tabView>
</h:form>
</h:body>
</f:view>
</html>
header.xhtml:
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<p:panelGrid id="pnlgLocaleChange" border="0">
<p:row>
<p:column rowspan="2">
<p:graphicImage value="images/TelenorLogoWhite.png" />
</p:column>
<p:column colspan="3" style="width:16%">
<h:outputText id="ApplicationBanner" class="bannerLabel"
value="#{msgs.title}" />
<h:outputText id="ApplicationVersion" value="#{msgs.Version} #{UsersBean.releaseLabel}" class="ApplicationVersion"/>
</p:column>
</p:row>
<p:row>
<p:column styleClass="LoginBannerLocale" style="padding-right: 0px !important;">
<h:outputText id="languageLabel" value="#{msgs.locale}" />
</p:column>
<p:column style="width:5%;">
<p:selectOneMenu value="#{language.locale}" styleClass="localeSelectClass">
<f:selectItems value="#{language.countries}" />
<p:ajax update="#form" />
</p:selectOneMenu>
</p:column>
</p:row>
<p:row rendered="#{not empty request.remoteUser}">
<!-- <p:column styleClass="HeaderWelcomeMsg" >
<h:outputText value="#{msgs.Welcome}, #{authenticatedBackingBean.userFullName}" style="float:middle !important; "/>
</p:column> -->
<p:column styleClass="LoginBannerLocale" colspan="2">
<h:outputText id="loggedInUser" value="#{msgs.loginUserMessage} #{request.remoteUser } (#{authenticatedBackingBean.roleDescription})| " />
<h:commandLink value=" #{msgs.Logout}" onclick="document.getElementById('headerForm').action='ibm_security_logout?logoutExitPage=/Login.xhtml';" />
</p:column>
</p:row>
</p:panelGrid>
</ui:composition>
AppUserManagement.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<p:fieldset id="fieldAppUserMgmt">
<p:panelGrid id="filterUsers" style="width:100%;">
<p:row>
<p:column style="left: 40%;">
<h:outputText id="applicationNameLabel" value="#{msgs.AppUserMgmt_AppName_Label}" />
<p:selectOneMenu value="#{AppUserManagementBean.applicationName}" styleClass="localeSelectClass" id="applicationName">
<f:selectItem itemLabel="Select One" itemValue="-1" />
<f:selectItems value="#{AppUserManagementBean.systemDetails}" />
<p:ajax update="groupName,userList" listener="#{AppUserManagementBean.loadGroupDetails}" />
</p:selectOneMenu>
</p:column>
</p:row>
<p:row>
<p:column style="left: 40%;">
<h:outputText id="groupNameLabel" value="#{msgs.AppUserMgmt_AppGroup_Label}" />
<p:selectOneMenu value="#{AppUserManagementBean.groupName}" styleClass="localeSelectClass" id="groupName">
<f:selectItem itemLabel="Select One" itemValue="-1" />
<f:selectItems value="#{AppUserManagementBean.groupDetails}" />
<p:ajax update="userList" listener="#{AppUserManagementBean.loadUserDetails}" />
</p:selectOneMenu>
</p:column>
</p:row>
<p:row>
<p:column>
<p:dataTable id="userList" var="user" value="#{AppUserManagementBean.lstUsrDetails}"
paginatorAlwaysVisible="false" paginator="true" rows="10"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} #{msgs.AppUserMgmt_AppUsers_List_PageSizeLabel} {RowsPerPageDropdown}"
rowsPerPageTemplate="5,10,15" rowIndexVar="rowNum" filteredValue="#{AppUserManagementBean.lstFilteredUsrDetails}"
widgetVar="usersFilter" rowKey="#{user.userId}" selectionMode="single" selection="#{AppUserManagementBean.selectedUser}">
<f:facet name="header">
<h:outputText id="appUsrMgmtUserListHeader" style="float:left" value="#{AppUserManagementBean.applicationName} #{msgs.AppUserMgmt_AppUsers_List_Title}"/>
<p:inputText id="globalFilter" onkeyup="usersFilter.filter()" style="float:right"/>
<p:watermark forElement="tabView:userList:globalFilter" value="#{msgs.AppUserMgmt_AppUsers_List_Find}"/>
</f:facet>
<p:column id="colRowNo" headerText="#{msgs.AppUserMgmt_AppUsers_List_RowNo}">
<h:outputText value="#{rowNum+1}" />
</p:column>
<p:column id="colUserID" headerText="#{msgs.AppUserMgmt_AppUsers_List_UserID}" filterBy="#{user.userId}" filterMatchMode="contains" style="text-align:bottom" filterStyle="display:none;visibility:hidden">
<h:outputText value="#{user.userId}" />
</p:column>
<p:column id="colName" headerText="#{msgs.AppUserMgmt_AppUsers_List_FullName}" filterBy="#{user.firstName} #{user.lastName}" filterMatchMode="contains" style="text-align:bottom" filterStyle="display:none;visibility:hidden">
<h:outputText value="#{user.firstName} #{user.lastName}" />
</p:column>
<p:column id="colRole" headerText="#{msgs.AppUserMgmt_AppUsers_List_Group}" filterBy="#{user.role}" filterMatchMode="contains" style="text-align:bottom" filterStyle="display:none;visibility:hidden">
<h:outputText value="#{user.role}" />
</p:column>
<p:column id="colEmail" headerText="#{msgs.AppUserMgmt_AppUsers_List_Email}" filterBy="#{user.email}" filterMatchMode="contains" style="text-align:bottom" filterStyle="display:none;visibility:hidden">
<h:outputText value="#{user.email}" />
</p:column>
<p:column id="colExpiryDate" headerText="#{msgs.AppUserMgmt_AppUsers_List_ExpiresOn}" filterBy="#{user.expiryDate}" filterMatchMode="contains" style="text-align:bottom" filterStyle="display:none;visibility:hidden">
<h:outputText value="#{user.expiryDate}" />
</p:column>
<f:facet name="footer">
<p:commandButton id="addUserButton" value="#{msgs.AppUserMgmt_AppUsers_NewUser_ButtonLabel}" icon="ui-icon-circle-plus" update=":headerForm:panelGridNewUserDialog" oncomplete="addNewUserDialog.show()"/>
</f:facet>
</p:dataTable>
</p:column>
</p:row>
</p:panelGrid>
</p:fieldset>
<p:dialog id="addNewUserDialog" header="#{msgs.AppUserMgmt_AppUsers_NewUser_Dialog_Header} #{AppUserManagementBean.groupName},#{AppUserManagementBean.applicationName}" widgetVar="addUserDialog" resizable="false"
width="400" showEffect="clip" hideEffect="fold">
<p:panelGrid id="panelGridNewUserDialog" styleClass="insertPage">
<p:row>
<p:column>
<h:outputText id="userIDDialog" value="#{msgs.userId}" />
</p:column>
</p:row>
</p:panelGrid>
</p:dialog>
</ui:composition>
Am I missing some thing here? I have tried to find the related question in stack but could not find any. I am happy to be redirected to right question or link if any.
I would appreciate anyone's help.
<tfoot>
<tr>
<td class="ui-datatable-footer ui-widget-header"
colspan="6">
<button id="tabView:userList:addUserButton" name="tabView:userList:addUserButton"
class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-left">
Rest of the code is not sent to browser. Lot of HTML code is not rendereed. May be some HTTP header are missing?
You set dynamic="true" which means that tabs are lazy loaded. That's why is your html code incomplete. Remove this attribute and see what's happening.
Also you wrote addNewUserDialog.show(), but your widget var name is addUserDialog, so try with addUserDialog.show().
You must try update ":headerForm:tabView:panelGridNewUserDialog"
with formId="headerForm" at the beginning and add ":"
I have see this problem.Please see my jsf page.
<h:form id="companyList">
<p:contextMenu for="companiesDB" style="height:53px;">
<p:menuitem value=" edit" update="panelGrid" icon="ui-icon-pencil" oncomplete="editCompany.show()" />
<p:menuitem value=" delete" update="panelGrid" icon="ui-icon-closethick" onclick="editCompany.show()" />
</p:contextMenu>
<p:dataTable id="companiesDB" var="companies"
value="#{companyController.companyList}" rowKey="#{companies.pkId}"
selection="#{companyController.selectedCompany}"
selectionMode="single" paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rows="20" >
<p:column headerText="name">
#{companies.companyName}
</p:column>
<p:column headerText="desc">
#{companies.description}
</p:column>
</p:dataTable>
<p:dialog header="edit mode" widgetVar="editCompany"
modal="true" height="160" width="390"
id="dialog" resizable="false">
<p:panelGrid cellpadding="10" id="panelGrid" >
<p:row>
<p:column width="300">
<h:outputText value="name:" style="float:left;" />
</p:column>
<p:column>
<p:inputText value="#{companyController.selectedCompany.companyName}"/>
</p:column>
</p:row>
<p:row>
<p:column>
<h:outputText value="desc:" style="float:right;" />
</p:column>
<p:column>
<p:inputText
value="#{companyController.selectedCompany.description}" />
</p:column>
</p:row>
</p:panelGrid>
<br />
<br />
<p:commandButton value="save" icon="ui-icon-check"
style="float:right; margin-right:25px;" update="companiesDB"
oncomplete="addCompany.hide();"
action="#{companyController.insertCompany()}">
</p:commandButton>
</p:dialog>
</h:form>
And console error was :
/company.xhtml #46,91 value="#{companyController.selectedCompany.companyName}": Target Unreachable, 'selectedCompany' returned null
try renaming your dialog id to mydialog (just to be on a safe side)
and update your menu item entry as following (notice the update="mydialog"):
<p:menuitem value="edit" update="mydialog" icon="ui-icon-pencil" oncomplete="editCompany.show()" />
also , make sure the edit button will be enabled only after a selection in table was made... otherwise you will get the null pointer...
you can achieve it with something like
<p:menuitem value="edit" disabled=#{companyController.selectedCompany eq null}.....
and add two p:ajax in your table
<p:dataTable.......>
<p:ajax event="rowSelect" update="contextMenuID" />
<p:ajax event="rowUnselect" update="contextMenuID" />
last thing : add id=contextMenuID to your context menu