我正在尝试实施primefaces celleditor。 下面是jsf代码
<h:form id="FeesManagementForm">
<p:panelGrid columns="2" >
<h:panelGroup id="feesHeadCreatePG">
<p:panelGrid columns="2">
<p:outputLabel value="#{bundle.CreateFeesHeadsLabel_feesHeadName}" for="feesHeadName" />
<p:inputText id="feesHeadName" value="#{feeManagementController.selectedFH.feesHeadName}" title="#{bundle.CreateFeesHeadsTitle_feesHeadName}" required="true" requiredMessage="#{bundle.CreateFeesHeadsRequiredMessage_feesHeadName}"/>
<p:outputLabel value="#{bundle.CreateFeesHeadsLabel_feesPayableFrequency}" for="feesPayableFrequency" />
<p:selectOneMenu id="feesPayableFrequency" value="#{feeManagementController.selectedFH.feesPayableFrequency}" required="true" requiredMessage="Frequency is required">
<f:selectItem itemLabel="Monthly" itemValue="Monthly" />
<f:selectItem itemLabel="Yearly" itemValue="Yearly" />
<f:selectItem itemLabel="Quaterly" itemValue="Quaterly" />
</p:selectOneMenu>
<p:outputLabel value="#{bundle.CreateFeesHeadsLabel_feesDescription}" for="feesDescription" />
<p:inputText id="feesDescription" value="#{feeManagementController.selectedFH.feesDescription}" title="#{bundle.CreateFeesHeadsTitle_feesDescription}" />
</p:panelGrid>
<p:commandButton action="#{feeManagementController.createFH}" value="#{bundle.Save}" update="feesHeadCreatePG datalist" />
</h:panelGroup>
<p:dataTable id="datalist" value="#{feeManagementController.itemsFH}" var="item"
editable="true"
paginator="true"
rowKey="#{item.feesHeadId}"
rows="10"
rowsPerPageTemplate="10,20,30,40,50"
>
<p:ajax event="rowEdit" listener="#{feeManagementController.onRowEditFH}" update="FeesManagementForm datalist" />
<p:ajax event="rowEditCancel" listener="#{feeManagementController.onRowCancelFH}" update="FeesManagementForm datalist" />
<p:column>
<f:facet name="header">
<h:outputText value="#{bundle.ListFeesHeadsTitle_feesHeadName}"/>
</f:facet>
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{item.feesHeadName}"/></f:facet>
<f:facet name="input"><p:inputText id="modelInput" value="#{item.feesHeadName}" style="width:100%"/></f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{bundle.ListFeesHeadsTitle_feesPayableFrequency}"/>
</f:facet>
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{item.feesPayableFrequency}"/></f:facet>
<f:facet name="input">
<p:selectOneMenu id="feesPayableFrequency" value="#{item.feesPayableFrequency}" required="true" requiredMessage="Frequency is required">
<f:selectItem itemLabel="Monthly" itemValue="Monthly" />
<f:selectItem itemLabel="Yearly" itemValue="Yearly" />
<f:selectItem itemLabel="Quaterly" itemValue="Quaterly" />
</p:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{bundle.ListFeesHeadsTitle_feesDescription}"/>
</f:facet>
<p:cellEditor>
<f:facet name="output"><h:outputText value="#{item.feesDescription}"/></f:facet>
<f:facet name="input"><p:inputText id="modelInput3" value="#{item.feesDescription}" style="width:100%"/></f:facet>
</p:cellEditor>
</p:column>
<p:column style="width:32px">
<p:rowEditor />
</p:column>
</p:dataTable>
</p:panelGrid>
</h:form>
当我尝试单击编辑按钮时,所有数据表单元格都可以按预期编辑。但是当我单击保存按钮时,呈现的jsf页面如下所示。 enter image description here
非常感谢任何帮助。
答案 0 :(得分:0)
我得到了解决方案。我意识到列表的getter方法没有正确编写。该列表在处理过程中得到了更新。 感谢!!!