jsf - Can not generate p:datatable in h:panelgrid values on ajax p:commandbutton update -
i developing project in jsf2.1 ,prettyfaces, hibernate 4 , primefaces getting problem here… ve 1 p:commandbutton calls ajax request condition checks that, financial year opened or not
<p:commandbutton id="isfinancialyearsubmitid" value="submit" update="isfinancialyearbooleanpanelgridid scenariotabviewid:budgetanalysisdatatableid" action="#{budgetanalysisaction.isfinancialyearopened}" oncomplete="isfinancialyearopenedoncomplete();"/>
there 3 value… if financial year opened ‘1’ if financial year closed ‘0’ if invalid ‘ -1’ if financial year closed or invalid image loaded text ,but problem here if financial year opened want generate p:datatable
<h:panelgrid columns="2" id="isfinancialyearbooleanpanelgridid" styleclass="panelgridcenter" > <h:column> <ui:fragment rendered="#{budgetanalysisaction.budgetfinancialyearbean.financialyearforproposalsbean == '-1'}"> <ui:fragment rendered="#{budgetanalysisaction.util.errorcode == '-1'}" > <h:outputtext value="<div class='n_error'><p>error . #{budgetanalysisaction.util.errormessage}</p></div>" escape="false"/> </ui:fragment> </ui:fragment> <ui:fragment rendered="#{budgetanalysisaction.budgetfinancialyearbean.financialyearforproposalsbean == '0'}"> <ui:fragment rendered="#{budgetanalysisaction.util.errorcode == '-1'}" > <h:outputtext value="<div class='n_error'><p>error . #{budgetanalysisaction.util.errormessage}</p></div>" escape="false"/> </ui:fragment> </ui:fragment> </h:column> <h:column> <ui:fragment rendered="#{budgetanalysisaction.budgetfinancialyearbean.financialyearforproposalsbean == '1'}"> <p:tabview id="scenariotabviewid" style="width:850px" > <p:tab title="scenario one" id="scen"> <p:datatable id="budgetanalysisdatatableid" editable="true" scrollable="true" scrollwidth="800" resizablecolumns="true" value="#{budgetanalysisaction.budgetscenariohescoproposalbean.budgetscenariohescoproposallistbean}" var="budgetscenariohescoproposallist"> … here columns </p:datatable> </p:tab> </p:tabview> </ui:fragment> </h:column> </h:panelgrid>
when submit command button update=” isfinancialyearbooleanpanelgridid scenariotabviewid:budgetanalysisdatatableid” process when financial year closed or invalid not generate p:datatable id="budgetanalysisdatatableid values when financial year opened
but when put
<p:tabview id="scenariotabviewid" style="width:850px" > <p:tab title="scenario one" id="scen"> <p:datatable id="budgetanalysisdatatableid" editable="true" scrollable="true" scrollwidth="800" resizablecolumns="true" value="#{budgetanalysisaction.budgetscenariohescoproposalbean.budgetscenariohescoproposallistbean}" var="budgetscenariohescoproposallist"> … here columns </p:datatable> </p:tab> </p:tabview>
outside the
<h:panelgrid columns="2" id="isfinancialyearbooleanpanelgridid" styleclass="panelgridcenter" >
p:datatable works fine me
any idea (y)
here full xhtml file
<?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"> <!-- <link rel="stylesheet" type="text/css" href="/css/style.css"></link> --> <h:head> <h:outputstylesheet name="style.css" library="css" target="head"/> <h:outputscript name="validate.js" library="js" target="head"/> <!-- no need here because file called mastertemplate due insert , define tag of jsf --> <h:outputscript name="jsf.js" library="javax.faces" target="head" /> <h:outputstylesheet name="login.css" library="css" target="head"/> </h:head> <!-- <body class="main_background"> --> <h:body > <p>hello </p> <ui:composition template="/template/mastertemplate.xhtml"> <ui:define name="content"> <f:view> <div id="main"> <div class="full_w" style="height: auto; max-width: 1045px; overflow: hidden;"> <div class="h_title">formation's proposal</div> <h:form styleclass="form" prependid="false" id="anaform"> <p:panel id="formationsproposalpenel" header="analysis budget"> <div class="divpanel"> <div align="right" class="divcontent"> <div align="left" style="margin-top: 10px;"> <h:panelgrid columns="4" id="isfinancialyearpanelgridid"> <h:column> <h:outputlabel value="enter financial year " /> </h:column> <h:column> <p:inputmask id="isfinancialyearfromid" style="width:50px" mask="9999" value="#{budgetanalysisaction.budgetfinancialyearbean.isfinancialyearfrombean}" /> - </h:column> <h:column> <p:inputmask id="isfinancialyeartoid" style="width:50px" mask="9999" value="#{budgetanalysisaction.budgetfinancialyearbean.isfinancialyeartobean}" /> </h:column> <h:column> <p:commandbutton id="isfinancialyearsubmitid" value="submit" update="isfinancialyearbooleanpanelgridid scenariotabviewid:budgetanalysisdatatableid" action="#{budgetanalysisaction.isfinancialyearopened}" oncomplete="isfinancialyearopenedoncomplete();"/> </h:column> </h:panelgrid> <p:separator id="separatorid" style="border:1px solid #b8b8b8;margin-top:5px; width:80%;"/> </div> <h:panelgrid columns="2" id="isfinancialyearbooleanpanelgridid" styleclass="panelgridcenter" > <h:column> <ui:fragment rendered="#{budgetanalysisaction.budgetfinancialyearbean.financialyearforproposalsbean == '-1'}"> <ui:fragment rendered="#{budgetanalysisaction.util.errorcode == '-1'}" > <h:outputtext value="<div class='n_error'><p>error . #{budgetanalysisaction.util.errormessage}</p></div>" escape="false"/> </ui:fragment> </ui:fragment> <ui:fragment rendered="#{budgetanalysisaction.budgetfinancialyearbean.financialyearforproposalsbean == '0'}"> <ui:fragment rendered="#{budgetanalysisaction.util.errorcode == '-1'}" > <h:outputtext value="<div class='n_error'><p>error . #{budgetanalysisaction.util.errormessage}</p></div>" escape="false"/> </ui:fragment> </ui:fragment> </h:column> <h:column> <ui:fragment rendered="#{budgetanalysisaction.budgetfinancialyearbean.financialyearforproposalsbean == '1'}"> <p:tabview id="scenariotabviewid" style="width:850px" > <p:tab title="scenario one" id="scen"> <p:datatable id="budgetanalysisdatatableid" editable="true" scrollable="true" scrollwidth="800" resizablecolumns="true" value="#{budgetanalysisaction.budgetscenariohescoproposalbean.budgetscenariohescoproposallistbean}" var="budgetscenariohescoproposallist"> <!-- <p:ajax event="rowedit" listener="#{}"/> --> <p:column headertext="edit" width="30"> <p:roweditor /> </p:column> <p:column headertext="sub head of accounts" width="150" > <h:outputtext value="#{budgetscenariohescoproposallist.budgetsubheadofaccountsbean.subheadofaccountnamebean}" /> </p:column> <p:column width="150" headertext="average of #{budgetscenariohescoproposallist.labellastthreeyearavgactualexpbean}" styleclass="wwrapth wraptd"> </p:column> <p:column width="150" headertext="actual expenditure of #{budgetscenariohescoproposallist.labellastthreeyearactualexpenditurebean}" styleclass="wwrapth wraptd"> </p:column> <p:column width="150" headertext="actual expenditure of #{budgetscenariohescoproposallist.labellasttwoyearactualexpenditurebean}" styleclass="wwrapth wraptd"> </p:column> <p:column width="150" headertext="actual expenditure of #{budgetscenariohescoproposallist.labellastyearactualexpenditurebean}" styleclass="wwrapth wraptd"> </p:column> <p:column width="150" headertext="average of allocated budget #{budgetscenariohescoproposallist.labellastthreeyearavgallocatebudgetbean}" styleclass="wwrapth wraptd"> </p:column> <p:column width="150" headertext="allocated budget of #{budgetscenariohescoproposallist.labellastthreeyearallocatebudgetbean}" styleclass="wwrapth wraptd"> </p:column> <p:column width="150" headertext="allocated budget of #{budgetscenariohescoproposallist.labellasttwoyearallocatebudgetbean}" styleclass="wwrapth wraptd"> </p:column> <p:column width="150" headertext="allocated budget of #{budgetscenariohescoproposallist.labellastyearallocatebudgetbean}" styleclass="wwrapth wraptd"> </p:column> <p:column width="150" headertext="expected expenditure" styleclass="wwrapth wraptd"> </p:column> <p:column width="150" headertext="next year budget" styleclass="wwrapth wraptd"> </p:column> <p:column width="150" headertext="" styleclass="wwrapth wraptd"> </p:column> </p:datatable> </p:tab> <p:tab title="scenario two"> </p:tab> <p:tab title="scenario three"> </p:tab> <p:tab title="scenario four"> </p:tab> </p:tabview> </ui:fragment> </h:column> </h:panelgrid> </div> </div> </p:panel> </h:form> </div> </div> </f:view> </ui:define> </ui:composition> </h:body> <!-- </body> --> </html>
i add comment, maybe found problem:
in p:commandbutton have:
update="isfinancialyearbooleanpanelgridid scenariotabviewid:budgetanalysisdatatableid"
shouldn't (did eat colon?)
update="isfinancialyearbooleanpanelgridid:scenariotabviewid:budgetanalysisdatatableid"
Comments
Post a Comment