日期:2014-05-16 浏览次数:20489 次
?
PrimeFaces官网?http://forum.primefaces.org
参考?http://forum.primefaces.org/viewtopic.php?f=3&t=7734?国外论坛
?
???1.用?<p:cellEditor> 标签的方式实现
? ?官方例子 ?
http://www.primefaces.org/showcase-labs/ui/datatableEditing.jsf
?
<p:column headerText="卸柜城市" style="width:55px"> <p:cellEditor> <f:facet name="output"> <h:outputText value="#{irisAR.dischargeCityUuid}" /> </f:facet> <f:facet name="input"> <p:inputText value="#{irisAR.dischargeCityUuid}" required="true" requiredMessage="卸柜城市 必填" style="width:100%"> <p:ajax event="valueChange" process="@this" listener="#{settlementIrisDetailAM.getDischargeFacilityCode}" update="dischargeFacilityCodeId" /> </p:inputText> </f:facet> </p:cellEditor> </p:column> <p:column headerText="卸柜堆场" style="width:50px"> <p:cellEditor> <f:facet name="output"> <h:outputText value="#{irisAR.dischargeFacilityCode}" /> </f:facet> <f:facet name="input"> <h:selectOneMenu value="#{irisAR.dischargeFacilityCode}" id="dischargeFacilityCodeId"> <f:selectItems value="#{settlementIrisDetailAM.dischargeFacilityLists}" var="codeItem" itemLabel="#{codeItem.gspFacilityName}" itemValue="#{codeItem.gspFacilityCode}" /> </h:selectOneMenu> </f:facet> </p:cellEditor> </p:column>? 效果图:?http://yhceye2010.iteye.com/admin/pictures/101142?
?
? ? 2.用隐藏的方式,利用?rendered 属性来控制隐藏和显示
<p:column> <f:facet name="header"> <h:outputText value="客户" /> </f:facet> <h:inputHidden id="hid" value="#{arIndex}" /> <h:outputText value="#{ar.customerCompany.customerNameCn}" rendered="#{!ar.rowEdit}" /> <h:selectOneMenu value="#{ar.settlementObjectCode}" style="width:150px" id="selARCust" required="true" requiredMessage="客户不能为空" rendered="#{ar.rowEdit}"> <f:selectItem itemLabel="" itemValue="" /> <f:selectItems value="#{settlementDetailAM.customers}" var="item" itemLabel="#{item.customerNameCn}" itemValue="#{item.localCustomerCode}" /> <f:param name="fliedName" value="settlementObjectCode" /> <p:ajax event="valueChange" listener="#{settlementDetailAM.addOtherItemsTest}" process="hid,@this" update="selARCust,txtVersion,otherArItemTable" /> </h:selectOneMenu> </p:column>
? 效果图:http://yhceye2010.iteye.com/admin/pictures/101144