jsf - Updating column values in PrimeFaces datatable -
i have datatable contains items quoted on, , has columns quantity, unit price, etc , want display total price item when unit price entered. code looks this:
<p:column styleclass="tdasheader" style="text-align:center" width="80" headertext="unit price"> <pe:inputnumber id="unitprice" value="#{quoteditem.quotedprice}" minvalue="0.01" maxvalue="999999999.99" decimalplaces="2" style="text-align: right;" size="10"> <p:ajax event="change" listener="#{supplierquotationbean.onamountchange}" process="@this" update="totalprice" /> <f:attribute name="quoteditem" value="#{quoteditem}" /> </pe:inputnumber> </p:column> <p:column styleclass="tdasheader" style="text-align:center" width="60" headertext="disc" footertext="total (inc dly)"> <pe:inputnumber id="discount" value="#{quoteditem.quoteddiscount}" minvalue="1" maxvalue="100" /> </p:column> <p:column styleclass="tdasheader" width="80" id="totalpricecol"> <f:facet name="header" style="text-align:center"> <h:outputtext value="total" /> </f:facet> <p:outputpanel id="totalprice" style="text-align:right; padding-right:10px"> <h:outputtext value="#{quoteditem.totalprice}"> <f:convertnumber pattern="#,##0.00"/> </h:outputtext> </p:outputpanel> <f:facet name="footer"> <p:outputpanel style="text-align:right; padding-right:10px"> <h:outputtext value="x#{supplierquotationbean.quotationtotalasstring}x" /> </p:outputpanel> </f:facet> </p:column>
as may have guessed i'm posting help, ajax update doesn't work - well, works first row only. i've tried changing value in update parameter "#{p:component('totalprice')}" same thing. i've tried using listener update follows:
string clientid = event.getcomponent().getclientid(); string totalpriceclientid = clientid.substring(0, clientid.lastindexof(":"))+":totalprice"; requestcontext requestcontext = requestcontext.getcurrentinstance(); requestcontext.update(totalpriceclientid);
... doesn't work either. more guess, if update whole datatable still same result, additionally lose value in unit price field (even process="@this")!
can please suggest how might able overcome problem?
i'm using primefaces 5.1.15 , myfaces 2.2.6.
many thanks, neil
Comments
Post a Comment