I couldnt find a solution for this issue for 1 day.
When I click to close button on dialog, it does nothing.
I tried to add modal="false" then It works. But in my situation it should be modal="true",
to prevent user to click anywhere else on screen. What did I wrong?
Thanks for your time.
<ui:composition template="/pages/admin/admin.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<ui:define name="center">
<h:form id="form">
<p:growl id="msgs" showDetail="true" />
<p:dataTable id="basicDT" var="user" value="#{userSelectionViewMB.users}">
<f:facet name="header">
<p:outputLabel value="#{menu['menu.admin.updateuser.list']}"/>
</f:facet>
<p:column headerText="#{menu['menu.admin.createuser.id']}">
<h:outputText value="#{user.id}" />
</p:column>
<p:column headerText="#{menu['menu.admin.createuser.name']}">
<h:outputText value="#{user.name}" />
</p:column>
<p:column headerText="#{menu['menu.admin.createuser.surname']}">
<h:outputText value="#{user.surname}" />
</p:column>
<p:column headerText="#{menu['menu.admin.createuser.grade']}">
<h:outputText value="#{user.grade}" />
</p:column>
<p:column style="width:32px;text-align: center">
<p:commandButton update=":form:userDetail" oncomplete="PF('userDialog').show()" icon="ui-icon-search" title="View">
<f:setPropertyActionListener value="#{user}" target="#{userSelectionViewMB.selectedUser}" />
</p:commandButton>
</p:column>
</p:dataTable>
<p:dialog header="User Info" widgetVar="userDialog" modal="true" showEffect="fade" closable="true"
closeOnEscape="true" hideEffect="fade" resizable="false">
<p:outputPanel id="userDetail" style="text-align:center;">
<p:panelGrid columns="2" rendered="#{not empty userSelectionViewMB.selectedUser}" columnClasses="label,value">
<h:outputText value="Id:" />
<h:outputText value="#{userSelectionViewMB.selectedUser.id}" />
<h:outputText value="Name" />
<h:outputText value="#{userSelectionViewMB.selectedUser.name}" />
<h:outputText value="Surname:" />
<h:outputText value="#{userSelectionViewMB.selectedUser.surname}" />
<h:outputText value="Grade" />
<h:outputText value="#{userSelectionViewMB.selectedUser.grade}" />
</p:panelGrid>
</p:outputPanel>
</p:dialog>
</h:form>
</ui:define>
I've tried this code:
<h:form id="form">
<p:growl id="msgs" showDetail="true" />
<p:commandButton update=":form:userDetail" oncomplete="PF('userDialog').show()" icon="ui-icon-search" title="View">
</p:commandButton>
<p:dialog header="User Info" widgetVar="userDialog" modal="true" showEffect="fade" closable="true" closeOnEscape="true" hideEffect="fade" resizable="false">
<p:outputPanel id="userDetail" style="text-align:center;">
<h:outputText value="Id:" />
<h:outputText value="1" />
<h:outputText value="Name" />
<h:outputText value="Mister" />
<h:outputText value="Surname:" />
<h:outputText value="Brown" />
<h:outputText value="Grade" />
<h:outputText value="first" />
</p:outputPanel>
</p:dialog>
</h:form>
and it works great! maybe the problem isn't the code that you posted. Did you check if there is any javascript error in your page?
Related
I have the following xhtml:
<f:metadata>
<f:viewParam name="livroId" value="#{livroBean.livro.id}" />
<f:viewAction action="#{livroBean.carregarLivroPelaId}"
if="#{param.livroId != null}" />
</f:metadata>
<ui:define name="titulo">
<p:outputPanel>Novo Livro</p:outputPanel>
</ui:define>
<ui:define name="conteudo">
<h:form>
<p:messages id="messages" />
<p:fieldset legend="Dados do Livro">
<p:panelGrid columns="2">
<p:outputLabel value="Titulo:" for="titulo" />
<p:inputText id="titulo" value="#{livroBean.livro.titulo}"
required="true" requiredMessage="Título obrigatório"
validatorMessage="Título não pode ser superior a 40">
<f:validateLength maximum="40" />
<f:ajax event="blur" render="messages" />
</p:inputText>
<p:outputLabel value="ISBN:" for="isbn" />
<p:inputMask id="isbn" value="#{livroBean.livro.isbn}"
validator="#{livroBean.comecaComDigitoUm}"
mask="999-9-99-999999-9" />
<p:outputLabel value="Preço:" for="preco" />
<p:inputText id="preco" value="#{livroBean.livro.preco}" />
<p:outputLabel value="Data de Lançamento:" for="dataLancamento" />
<p:calendar id="dataLancamento"
value="#{livroBean.livro.dataLancamento.time}"
pattern="dd/MM/yyyy" timeZone="America/Sao_Paulo" mask="true" />
</p:panelGrid>
</p:fieldset>
<br />
<p:fieldset legend="Dados do Autor">
<p:panelGrid columns="4">
<p:outputLabel value="Selecione Autor:" for="autor" />
<p:selectOneMenu value="#{livroBean.autorId}" id="autor">
<f:selectItems value="#{livroBean.autores}" var="autor"
itemLabel="#{autor.nome}" itemValue="#{autor.id}" />
</p:selectOneMenu>
<p:commandButton value="Gravar Autor"
action="#{livroBean.gravarAutor}" process="#this autor"
update="tabelaAutores" />
<p:commandLink value="ou cadastrar novo autor"
action="#{livroBean.formAutor}" immediate="true" update="#all" />
</p:panelGrid>
<p:dataTable value="#{livroBean.autoresDoLivro}" var="autor"
id="tabelaAutores" emptyMessage="Nenhum autor">
<p:column>
<h:outputText value="#{autor.nome}" />
</p:column>
<p:column>
<p:commandLink value="X"
action="#{livroBean.removerAutorDoLivro(autor)}"
update="tabelaAutores" process="#this" />
</p:column>
</p:dataTable>
</p:fieldset>
<br />
<h:panelGrid style="margin: 0 auto">
<p:commandButton value="Gravar" action="#{livroBean.gravar}"
process="#form" update="#form :formTabelaLivros:tabelaLivros" />
</h:panelGrid>
</h:form>
<br />
<h:form id="formTabelaLivros">
<p:dataTable value="#{livroBean.livros}" var="livro"
id="tabelaLivros" paginator="true" rows="5">
<f:facet name="header">Livros</f:facet>
<p:column headerText="Título" sortBy="#{livro.titulo}"
filterBy="#{livro.titulo}" filterMatchMode="startsWith">
<h:outputText value="#{livro.titulo}" />
</p:column>
<p:column headerText="ISBN" sortBy="#{livro.isbn}">
<h:outputText value="#{livro.isbn}" />
</p:column>
<p:column headerText="Preço" sortBy="#{livro.preco}">
<h:outputText value="#{livro.preco}">
<f:convertNumber type="currency" pattern="R$ #0.00"
currencySymbol="R$" locale="pt_BR" />
</h:outputText>
</p:column>
<p:column headerText="Data" sortBy="#{livro.dataLancamento.time}">
<h:outputText value="#{livro.dataLancamento.time}">
<f:convertDateTime pattern="dd/MM/yyyy"
timeZone="America/Sao_Paulo" />
</h:outputText>
</p:column>
<p:column headerText="Alterar">
<h:commandLink value="Alterar" action="#{livroBean.carregar(livro)}" />
</p:column>
<p:column headerText="Remover">
<h:commandLink value="Remover" action="#{livroBean.remover(livro)}" />
</p:column>
</p:dataTable>
</h:form>
</ui:define>
The h:commandLink "Remover" is actually removing the object from my database, but is not updating the DataTable. I've already set process="#form" update="#form", but it doesn't help.
It was actually working fine before, and it suddenly stopped (I didn't modify anything related to my bean).
EDIT:
I changed it to a CommandButton, as below:
<p:column headerText="Remover">
<p:commandButton icon="fa fa-fw fa-remove" actionListener="#{livroBean.remover(livro)}" process="#form" update="#form" />
</p:column>
But still no results... The button works, it removes the entry from my database, but it does not updates the datatable. Tried with action= as well.
I have an issue with the footer row that i need to display in primefaces. In UI there is an extra space that comes up between the grid and the footer row which is kind of annoying. Is there anything that is going wrong. Any suggestions are most welcome. Please find my below code.
<!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:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets"
>
<h:head>
</h:head>
<body style="height: 90%">
<ui:composition template="template/common/commonPrimefacesLayout.xhtml">
<ui:define name="content">
<h:form id="searchFormForResult" prependId="false">
<h:inputHidden id="rowId" value="#{MBean.selectedRowId}"></h:inputHidden>
<p:accordionPanel style="align:top;margin" prependId="false">
<p:tab title="Search Items">
<p:panelGrid columns="2" cellpadding="5">
<p:outputLabel for="expenseDesc" value=" Description: " />
<p:selectOneMenu id="expenseDesc" widgetVar="expenseDesc" value="#{searchMBean.searchCriteria.shortDesc}" style="width:150px" editable="true" filter="true" filterMatchMode="startsWith">
<f:selectItem itemLabel="All" itemValue="All" noSelectionOption="false"/>
<f:selectItems value="#{searchMBean.shortDescriptionList}" />
</p:selectOneMenu>
</p:panelGrid>
<p:commandButton id="Reset" actionListener="#{searchMBean.resetForm}" value="Reset" ajax="false" style="float:right;" onclick="resetSearchForm()"></p:commandButton>
<p:commandButton id="Submit" action="#{searchMBean.search}" value="Submit" ajax="false" style="float:right;"></p:commandButton>
</p:tab>
</p:accordionPanel>
<p:panel>
<h:outputLabel value="Search Results" style="font-weight: bold;"></h:outputLabel>
<p:dataTable id="SearchResult" var="SearchResult" value="#{searchMBean.searchResult}" selection="#{MBean.itemsSearchResult}" rowKey="#{searchResult.id}" scrollable="true" rowSelectMode="multiple" scrollHeight="65%">
<p:column selectionMode="multiple" style="width:5%;"/>
<p:column>
<f:facet name="header">
<h:outputText value="Contact Name" />
</f:facet>
<h:outputText value="#{mBean.name}" />
<f:facet name="footer">
<h:outputText value="#{mBean.name}" />
</f:facet>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Contact Address" />
</f:facet>
<h:outputText value="#{mBean.addr}" />
<f:facet name="footer">
<h:outputText value="#{mBean.name}" />
</f:facet>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Actions" />
</f:facet>
<p:commandButton action="#{MBean.display}" icon="ui-icon ui-icon-search" title="ViewButton" oncomplete="disableFields('singleRowView');">
<f:param name="itemId" value="#{searchResult.id}"></f:param>
</p:commandButton>
<p:commandButton action="#{MBean.display}" icon="ui-icon ui-icon-pencil" title="UpdateButton" oncomplete="disableFields('singleRowView');">
<f:param name="itemId" value="#{Result.id}"></f:param>
</p:commandButton>
<p:commandButton id="delete"
icon="ui-icon ui-icon-trash"
action="#{MBean.ItemRow}"
onclick="setSelectedRowId('rowId',#{result.id})"
title="GDeleteButton">
<p:confirm header="Delete Record"
message="Are you sure about deleting this record?"
icon="ui-icon-alert"/>
</p:commandButton>
<p:confirmDialog global="true" showEffect="fade">
<p:commandButton title="GDelYesButton" value="Yes" styleClass="ui-confirmdialog-yes"/>
<p:commandButton title="GDelNoButton" value="No" onclick="PF('confirmation').hide()" styleClass="ui-confirmdialog-no" />
</p:confirmDialog>
</p:column>
</p:dataTable>
<p:panelGrid id="groupActions" columns="5">
<p:commandButton action="#{MBean.viewItems}" icon="ui-icon ui-icon-search" value="View" title="GViewButton" oncomplete="disableFields('groupView');">
</p:commandButton>
<p:commandButton action="#{MBean.viewItems}" icon="ui-icon ui-icon-pencil" value="Update" title="GUpdateButton" oncomplete="disableFields('groupView');">
</p:commandButton>
<p:button outcome="createItem" value="Add New" title="AddNewButton"/>
<p:commandButton id="delete" action="#{MBean.delete}" icon="ui-icon ui-icon-trash" value="Delete" title="Delete" >
<p:confirm header="Delete Record" message="Are you sure about deleting this record?" icon="ui-icon-alert"/>
</p:commandButton>
<p:commandButton actionListener="#{searchMBean.resetForm}" value="Cancel" title="Cancel" ajax="false"></p:commandButton>
</p:panelGrid>
<p:confirmDialog global="true" showEffect="fade">
<p:commandButton title="Yes" value="Yes" styleClass="ui-confirmdialog-yes" />
<p:commandButton title="No" value="No" styleClass="ui-confirmdialog-no" onclick="PF('groupDeleteConfirm').hide()" />
</p:confirmDialog>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</body>
</html>
Also please find the image of the behaviour. The extra spaace that is coming between grid and the footer. Please help.
I have this .xhtml file. It's a data table page with three buttons (one for creating users, one for editing them and one for deleting them). Creating and deleting users are working but updating not. When I call the method actionListener="#{usuariosBean.actualizarUsuario}", I get all parameters well but not the Id, I'm getting 0 instead of the real Id of the user.
I have tried to do it in different .xhtml and it work good so I think that the problem is about the .xhtml file but... I don't know. Could anybody help me? Thanks a lot!!!
<?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:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<body>
<ui:composition template="./../template.xhtml">
<ui:define name="content">
<p:growl id="msgs" showDetail="true" />
<h:form>
<p:commandButton update=":formCrear" icon="ui-icon-document"
title="Crear Usuario" value="Crear Usuario"
oncomplete="PF('usuarioDialogCrear').show();">
</p:commandButton>
</h:form>
<h:form id="form">
<p:dataTable var="usuario" value="#{usuariosBean.usuarios}"
paginator="true" rows="10">
<p:column headerText="Id">
<h:outputText value="#{usuario.id}" />
</p:column>
<p:column headerText="Nombre de Usuario">
<h:outputText value="#{usuario.nombreDeUsuario}" />
</p:column>
<p:column headerText="Contraseña">
<h:outputText value="#{usuario.contrasenya}" />
</p:column>
<p:column headerText="Rol">
<h:outputText value="#{usuario.rol}" />
</p:column>
<p:column headerText="" style="text-align:center; width:4%">
<p:commandButton update=":form:usuarioActualizar" id="Actualizar"
icon="ui-icon-pencil" title="Actualizar"
oncomplete="PF('usuarioDialogActualizar').show();">
<f:setPropertyActionListener value="#{usuario}"
target="#{usuariosBean.usuarioSeleccionado}" />
</p:commandButton>
</p:column>
<p:column headerText="" style="text-align:center; width:4%">
<p:commandButton update=":form:usuarioEliminar" id="Eliminar"
icon="ui-icon-close" title="Eliminar"
oncomplete="PF('confirmacion').show();">
<f:setPropertyActionListener value="#{usuario}"
target="#{usuariosBean.usuarioSeleccionado}" />
</p:commandButton>
</p:column>
</p:dataTable>
<p:dialog header="Actualizar Usuario"
widgetVar="usuarioDialogActualizar" modal="true" showEffect="fade"
hideEffect="explode" resizable="false" width="400">
<p:outputPanel id="usuarioActualizar" style="text-align:center;"
layout="block">
<p:panelGrid columns="2">
<h:outputText value="Id " />
<p:inputText
value="#{usuariosBean.usuarioSeleccionado.id}"
style="font-weight:bold" size="37" />
<h:outputText value="Usuario: " />
<p:inputText
value="#{usuariosBean.usuarioSeleccionado.nombreDeUsuario}"
style="font-weight:bold" size="37" />
<h:outputText value="Contraseña: " />
<p:inputText
value="#{usuariosBean.usuarioSeleccionado.contrasenya}"
style="font-weight:bold" size="37" />
<h:outputText value="Rol " />
<p:inputText value="#{usuariosBean.usuarioSeleccionado.rol}"
style="font-weight:bold" size="37" />
</p:panelGrid>
</p:outputPanel>
<f:facet name="footer">
<p:commandButton update=":form, :msgs" id="btnActualizarAceptar"
icon="ui-icon-disk" title="Guardar Usuario"
value="Actualizar Usuario"
actionListener="#{usuariosBean.actualizarUsuario}"
oncomplete="PF('usuarioDialogActualizar').hide()">
</p:commandButton>
<p:commandButton id="btnActualizarCancelar" icon="ui-icon-close"
title="Cancelar" value="Cancelar" type="button"
onclick="PF('usuarioDialogActualizar').hide()">
</p:commandButton>
</f:facet>
</p:dialog>
<p:confirmDialog
message="¿Está seguro que desea eliminar el usuario?"
showEffect="bounce" hideEffect="explode" header="Eliminar Usuario"
severity="alert" widgetVar="confirmacion">
<p:outputPanel id="usuarioEliminar" style="text-align:center;"
layout="block">
<h:inputHidden value="#{usuariosBean.usuarioSeleccionado.id}" />
</p:outputPanel>
<p:commandButton id="confirmarDialogo" value="Aceptar"
icon="ui-icon-check" update=":form, :msgs"
oncomplete="PF('confirmacion').hide()"
actionListener="#{usuariosBean.eliminarUsuario}" />
<p:commandButton id="cancelarDialogo" icon="ui-icon-close"
title="Cancelar" value="Cancelar"
oncomplete="PF('confirmacion').hide()">
</p:commandButton>
</p:confirmDialog>
</h:form>
<h:form id="formCrear">
<p:dialog header="Crear Usuario" widgetVar="usuarioDialogCrear"
modal="true" showEffect="fade" hideEffect="explode"
resizable="false" width="400">
<p:outputPanel id="usuarioCrear" style="text-align:center;"
layout="block">
<p:panelGrid columns="2">
<h:outputText value="Usuario: " />
<p:inputText value="#{usuariosBean.nombreDeUsuario}"
required="true" size="37" />
<h:outputText value="Contraseña: " />
<p:inputText value="#{usuariosBean.contrasenya}" required="true"
size="37" />
<h:outputText value="Rol " />
<p:inputText value="#{usuariosBean.rol}" required="true"
size="37" />
</p:panelGrid>
</p:outputPanel>
<f:facet name="footer">
<p:commandButton update=":form, :msgs" id="btnCrearAceptar"
icon="ui-icon-disk" title="Guardar Usuario"
value="Guardar Usuario" action="#{usuariosBean.guardarUsuario}"
oncomplete="PF('usuarioDialogCrear').hide()">
</p:commandButton>
<p:commandButton id="btnCrearCancelar" icon="ui-icon-close"
title="Cancelar" value="Cancelar"
oncomplete="PF('usuarioDialogCrear').hide()">
</p:commandButton>
</f:facet>
</p:dialog>
</h:form>
</ui:define>
</ui:composition>
</body>
</html>
In dataList i'm displaying records and given edit and delete option,
While deleting i need to check my requirement depending on that i need to delete record,
But after delete DataList is not updating.
Could you please solve my problem...
<?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:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<ui:composition template="PageTemplate.html">
<ui:define name="content">
<h:form id="form"
style="width: 70% !important; margin: 100px 0px 0px 205px;">
<!-- <p:growl id="growl" showDetail="true" autoUpdate="true" sticky="false"/> -->
<!-- <p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" /> -->
<p:tabView id="TabView" style="height:450px;"
activeIndex="#{appraisalComponent.tabindex}">
<p:ajax event="tabChange"
listener="#{appraisalComponent.getSectionAllList}" update="#form" />
<p:tab id="tab1" title="Create Section">
<p:outputPanel id="createSectionIds">
<p:dataTable id="sectionList" paginator="true" rows="5"
value="#{appraisalComponent.sectionListEdit}" var="sections"
editable="true">
<p:ajax event="rowEdit"
listener="#{appraisalComponent.updateSection(sections)}"
update=":form:TabView:sectionList" />
<p:ajax event="rowEditCancel" update=":form:TabView:sectionList" />
<p:column>
<f:facet name="header">
<h:outputText value="Section Name" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{sections.secName}" />
</f:facet>
<f:facet name="input">
<h:inputText value="#{sections.secName}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Operation" />
</f:facet>
<p:rowEditor />
<p:spacer width="20" height="0" />
<p:commandButton includeViewParams="true"
style="margin:-18px 0px 0px 20px;" title="Remove"
update=":form:TabView:createSectionIds"
process=":form:TabView:createSectionIds" icon="ui-icon-trash"
oncomplete="${appraisalComponent.sectionHaveQS(sections)} ? PF('confirmDialogDelete').show() : PF('confirmDialog').show()">
<f:setPropertyActionListener value="#{sections}"
target="#{appraisalComponent.selectedSec}" />
</p:commandButton>
<p:dialog header="Delete confirmation" appendToBody="true"
widgetVar="confirmDialogDelete" resizable="false" id="secDlg"
showEffect="fade" hideEffect="explode" modal="true">
Are you sure, you want to delete Employee:<h:outputText
value="#{appraisalComponent.selectedSec.secName}" />
<br></br>
<p:commandButton value="Yes Sure"
onclick="confirmDialogDelete.hide()"
action="#{appraisalComponent.deleteSection(appraisalComponent.selectedSec)}"
update=":form:TabView:createSectionIds"
process=":form:TabView:createSectionIds"
style=" margin-left: 34px;">
<p:collector value="#{appraisalComponent.selectedSec}"
removeFrom="#{appraisalComponent.sectionListEdit}" />
</p:commandButton>
<p:commandButton value="Not Yet"
onclick="confirmDialogDelete.hide()" type="button" />
</p:dialog>
<!-- <p:commandButton value="Remove" includeViewParams="true"
update=":form:TabView:createSectionIds"
process=":form:TabView:createSectionIds"
oncomplete="${appraisalComponent.sectionHaveQS(sections)} ? PF('confirmDialogDelete').show() : PF('confirmDialog').show()">
<f:setPropertyActionListener value="#{sections}"
target="#{appraisalComponent.selectedSec}" />
</p:commandButton>
<p:dialog header="Delete confirmation" appendTo="#(body)"
widgetVar="confirmDialogDelete" resizable="false"
showEffect="fade" hideEffect="explode" modal="true">
Are you sure, you want to delete Section:<h:outputText
value="#{appraisalComponent.selectedSec.secName}" />
<br></br>
<p:commandButton value="Yes Sure"
onclick="confirmDialogDelete.hide()"
action="#{appraisalComponent.deleteSection(appraisalComponent.selectedSec)}"
update=":form:TabView:createSectionIds"
process=":form:TabView:createSectionIds"
style=" margin-left: 34px;">
<p:collector value="#{appraisalComponent.selectedSec}"
removeFrom="#{appraisalComponent.sectionListEdit}" />
</p:commandButton>
<p:commandButton value="Not Yet"
onclick="confirmDialogDelete.hide()" />
</p:dialog>
-->
<p:dialog header="Delete confirmation" appendTo="#(body)"
widgetVar="confirmDialog" resizable="false" showEffect="fade"
hideEffect="explode" modal="true">
You need to delete questions which are belongs to this section...!<h:outputText
value="" />
<br></br>
<p:commandButton value="Ok" onclick="confirmDialog.hide()"
type="button" />
</p:dialog>
<!-- <p:commandButton value="Remove"
action="#{appraisalComponent.deleteSection(sections)}"
update=":form:TabView:createSectionIds"
process=":form:TabView:createSectionIds">
<p:collector value="#{sections}"
removeFrom="#{appraisalComponent.sectionListEdit}" />
</p:commandButton> -->
</p:column>
</p:dataTable>
</p:outputPanel>
</p:tab>
<p:tab id="tab2" title="Remarks List"
action="#{appraisalComponent.test}">
<p:outputPanel id="remarksIds">
<p:dataTable id="remarksList" paginator="true" rows="5"
value="#{appraisalComponent.remarksListEdit}" var="remarks"
editable="true">
<p:ajax event="rowEdit"
listener="#{appraisalComponent.updateRemarks(remarks)}"
update=":form:TabView:remarksList" />
<p:ajax event="rowEditCancel" update=":form:TabView:remarksList" />
<p:column>
<f:facet name="header">
<h:outputText value="Remarks Name" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{remarks.remName}" />
</f:facet>
<f:facet name="input">
<h:inputText value="#{remarks.remName}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Remarks Value" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{remarks.remValue}" />
</f:facet>
<f:facet name="input">
<h:inputText value="#{remarks.remValue}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Operation" />
</f:facet>
<p:rowEditor />
<p:commandButton value="Remove"
action="#{appraisalComponent.deleteRemarks(remarks)}"
update=":form:TabView:remarksIds"
process=":form:TabView:remarksIds">
<p:collector value="#{remarks}"
removeFrom="#{appraisalComponent.remarksListEdit}" />
</p:commandButton>
</p:column>
</p:dataTable>
</p:outputPanel>
</p:tab>
<p:tab id="tab3" title="Priority List">
<p:outputPanel id="priorityIds">
<p:dataTable id="priorityList" paginator="true" rows="5"
value="#{appraisalComponent.priorityListEdit}" var="priority"
editable="true">
<p:ajax event="rowEdit"
listener="#{appraisalComponent.updatePriority(priority)}"
update=":form:TabView:priorityList" />
<p:ajax event="rowEditCancel"
update=":form:TabView:priorityList" />
<p:column>
<f:facet name="header">
<h:outputText value="Priority Name" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{priority.prName}" />
</f:facet>
<f:facet name="input">
<h:inputText value="#{priority.prName}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Operation" />
</f:facet>
<p:rowEditor />
<p:commandButton value="Remove"
action="#{appraisalComponent.deletePriority(priority)}"
update=":form:TabView:priorityIds"
process=":form:TabView:priorityIds">
<p:collector value="#{priority}"
removeFrom="#{appraisalComponent.priorityListEdit}" />
</p:commandButton>
</p:column>
</p:dataTable>
</p:outputPanel>
</p:tab>
<p:tab id="tab4" title="List Of Section">
<p:dataTable id="dataTable" var="sections"
value="#{appraisalComponent.sectionListToAddQues}"
paginator="true" rows="5">
<p:column>
<f:facet name="header">
<h:outputText value="Section Name :" />
</f:facet>
<h:outputText value="#{sections.secName}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Operation" />
</f:facet>
<p:commandLink value="Edit Questions"
action="#{appraisalComponent.editQuestions}">
<f:param name="sectionId" value="#{sections.secId}" />
</p:commandLink>
</p:column>
</p:dataTable>
<br></br>
</p:tab>
</p:tabView>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
What ever i given in top that is correct, but problem with java method.
to delete, i given one java method " action="#{appraisalComponent.deleteSection(appraisalComponent.selectedSec)}" "
In java that is returning one value like below
public String deleteSection (int secId) {
String temp ;
// some code
return temp;
}
But we should provide only void method like below
public void deleteSection (int secId) {
}
I changed this now my code working fine.
Any way thanks. :)
My xhtml, If i put my CommandButton into the h:form the Actionlistener is not called:
<ui:composition template="/template.xhtml">
<style>
</style>
<ui:define name="title">
<h:outputText value="#{bundle.ListDashboardTitle}"></h:outputText>
</ui:define>
<ui:define name="body">
<h:form id="formDashboard">
<p:layout id="layoutVar" style="min-height:500px;">
<p:layoutUnit id="gridLeft" position="west" size="250" style="position:absolute;">
<p:fieldset style="padding:0;padding-top:5px">
<f:facet name="legend" id="legendId">
<p:commandButton id="addEvent" type="button" icon="ui-icon-plus" value="" onclick="addMemo.show()" update=":formAddMemo" style="width:30px;height:30px;"/>
</f:facet>
<p:dataGrid id="leftData" var="item" columns="1" value="#{myMemosController.items}" style="border:none;">
<p:panel id="pnl" styleClass="" style="background-color:#{item.priority}}" closable="true">
<!-- <p:ajax event="close" listener=""/>-->
<f:facet name="header">
<h:panelGroup>
<h:outputText value="#{item.name}" styleClass=""/>
<p:commandButton icon="ui-icon-pencil" actionListener="#{myMemosController.prepareEdit}" update=":editForm" onclick="editMemo.show();" style="width:19px;height:19px;"/>
</h:panelGroup>
</f:facet>
<f:facet name="footer">
<h:outputText value="#{item.date} at #{item.time}" styleClass="footerStyle"/>
</f:facet>
<h:panelGrid columns="1" style="width:100%">
<h:outputText value="#{item.comments}" styleClass=""/>
</h:panelGrid>
</p:panel>
<p:draggable for="pnl" helper="clone" handle=".ui-panel-titlebar" stack=".ui-panel" zindex="100"/>
</p:dataGrid>
</p:fieldset>
</p:layoutUnit>
<p:layoutUnit position="center" style="position:absolute;">
<p:outputPanel id="dropArea">
<p:dataTable id="centerGrid" value="#{dashboardController.items}" var="item">
<p:column style="text-align:center;">
<f:facet name="header">
<h:outputText value="Priority"/>
</f:facet>
<h:outputText value="#{item.priorityname}"/>
</p:column>
<p:column style="text-align:center;">
<f:facet name="header">
<h:outputText value="Name"/>
</f:facet>
<h:outputText value="#{item.name}"/>
</p:column>
<p:column style="text-align:center;">
<f:facet name="header">
<h:outputText value="Comment"/>
</f:facet>
<h:outputText value="#{item.comments}"/>
</p:column>
<p:column style="text-align:center;">
<f:facet name="header">
<h:outputText value="Time"/>
</f:facet>
<h:outputText value="#{item.time}"/>
</p:column>
<p:column style="text-align:center;">
<f:facet name="header">
<h:outputText value="Date"/>
</f:facet>
<h:outputText value="#{item.date}"/>
</p:column>
</p:dataTable>
</p:outputPanel>
<p:droppable id="droppablePanel" tolerance="touch" activeStyleClass="ui-state-highlight">
</p:droppable>
</p:layoutUnit>
<p:layoutUnit id="gridRight" position="east" size="250" style="position:absolute;">
<p:dataGrid id="rightGrid" var="item" columns="1" value="#{usersMemosController.items}">
<p:panel id="pnl" styleClass="" style="background-color:#{item.priority}}" closable="true">
<f:facet name="header">
<h:outputText value="#{item.name}" styleClass=""/>
</f:facet>
<f:facet name="footer">
<h:outputText value="#{item.date} at #{item.time}" styleClass="footerStyle"/>
</f:facet>
<h:panelGrid columns="1" style="width:100%">
<h:outputText value="#{item.comments}" styleClass=""/>
</h:panelGrid>
</p:panel>
<p:draggable for="pnl" helper="clone" handle=".ui-panel-titlebar" stack=".ui-panel" zindex="100"/>
</p:dataGrid>
</p:layoutUnit>
</p:layout>
</h:form>
<p:dialog id="dialogEditMemo" header="Edit Memo" widgetVar="editMemo" resizable="false" closable="true" closeOnEscape="true" draggable="false">
<h:form id="editForm">
<h:messages style="color:red;margin:8px;" />
<h:panelGrid columns="1" cellpadding="3">
<p:inputTextarea id="commentEditInput" value="#{myMemosController.currentComment}" rows="6" required="true">
<p:ajax event="keyup" />
<p:ajax event="change" />
</p:inputTextarea>
<p:watermark for="commentEditInput" value="Enter your memo..."/>
<h:panelGrid columns="2" cellpadding="1">
<h:outputLabel for="selectEditShare" value="Share Memo: " style="margin-right:40px;"/>
<p:selectBooleanCheckbox id="selectEditShare" label="selectEditShare"/>
</h:panelGrid>
<p:selectOneMenu id="chooseEditPriority" value="#{myMemosController.currentPriority}">
<f:selectItem itemLabel="Low Priority" itemValue="Low Priority" />
<f:selectItem itemLabel="Medium Priority" itemValue="Medium Priority" />
<f:selectItem itemLabel="High Priority" itemValue="High Priority" />
</p:selectOneMenu>
</h:panelGrid>
</h:form>
<p:panel id="panelEditBtn" style="border:none;">
<p:commandButton icon="ui-icon-close" value="Reset" type="reset"/>
<p:commandButton icon="ui-icon-check" actionListener="#{myMemosController.update}" value="Edit" process="#this" update=":formDashboard:leftData" onsuccess="editMemo.hide();"/>
</p:panel>
</p:dialog>
</ui:define>
</ui:composition>
When i want to display InputTextarea value is equal null:
public String update() {
System.out.println(getCurrentComment());
}
Thanks in advance
The problem is in your managedBean you have not instansiated the object currentComment .
And Please try to avoid nested form in your application.
I have gone with the same issue the issue is that sometime value is not set to the managedBean by ajax. So modify your <p:inputTextArea /> with the below code it works.
<p:inputTextarea id="commentEditInput"
value="#{myMemosController.currentComment}"rows="6" required="true">
<p:ajax event="keyup" />
<p:ajax event="change" />
</p:inputTextarea>
And For your actionListener just try to use process attribute that might work..
<p:commandButton id="submitEditDialog" icon="ui-icon-check"
actionListener="#{myMemosController.update}" value="Edit"
update=":formDashboard:leftData :editForm" onsuccess="editMemo.hide();"
process="#this"
/>