Rerender HTMLInputText in datatable (richfaces-art-datatable
willy_makeit May 2, 2007 11:16 AMHi all,
(see http://jboss.com/index.html?module=bb&op=viewtopic&t=105668&postdays=0&postorder=asc&start=0 )
Sergey, I have seen your example on richfaces-art-datatable on how to reRender a column in a datatable
http://labs.jboss.com/wiki/RichFacesArticleDataTable
I am working with Kristein and we are probably the reason why you created this example. I am able to get our code working, i.e. correctly reRendering a column in a dataTable, but only when reRendering an HTMLOutputText component like your example does.
In our case we need to allow the user to enter either a ProposedPrice or a ProposedGrossMargin. Whenever the user enters a ProposedGrossMargin, the app should calculate a ProposedPrice based on that grossMargin and vice versa. Thus, both have to be HTMLInputText components.
And therein lies our problem. If the user changes the ProposedPrice the ProposedGrossMargin doesn't get reRendered. Debugging the app shows that, indeed the DTOs are being updated correctly with the correct values, but the corresponding column is not reRendered.
Can you expand your example to attempt to reRender an HTMLInputText?
Here is a code snippet of the JSP:
<rich:dataTable value="#{PriceModelHeaderBean.listDataModel}" var="item" first="#{PriceModelHeaderBean.currentRowIndex}" rows="#{PriceModelHeaderBean.rowsPerPage}" styleClass="partDataTable" rowClasses="rowLight, rowDark" headerClass="dataHeader" border="0" cellspacing="0"> . . . <h:column> <f:facet name="header"> <h:commandLink action="#{PriceModelHeaderBean.sort}" actionListener="#{PriceModelHeaderBean.bindSortColumn}" value="Proposed Price" immediate="false"> <f:attribute name="sortColumn" value="dto.proposedPrice"/> </h:commandLink> </f:facet> <a4j:outputPanel> <h:inputText id="price" binding="#{PriceModelHeaderBean.proposedPriceRef}" value="#{item.dto.proposedPrice}"> <a4j:support immediate="true" action="#{PriceModelHeaderBean.changePrice}" event="onchange" reRender="grossMargin"/> </h:inputText> <h:message for="price" /> </a4j:outputPanel> </h:column> <h:column> <f:facet name="header"> <h:commandLink action="#{PriceModelHeaderBean.sort}" actionListener="#{PriceModelHeaderBean.bindSortColumn}" value="Proposed GM%" immediate="false"> <f:attribute name="sortColumn" value="dto.proposedGrossMargin"/> </h:commandLink> </f:facet> <a4j:outputPanel> <h:inputText id="grossMargin" binding="#{PriceModelHeaderBean.proposedGMRef}" value="#{item.dto.proposedGrossMargin}" > <a4j:support immediate="true" action="#{PriceModelHeaderBean.changeGrossMargin}" event="onchange" reRender="price"/> </h:inputText> <h:message for="grossMargin" /> </a4j:outputPanel> </h:column> . . . </rich:dataTable> . . . <a4j:outputPanel id="err" ajaxRendered="true"> <h:messages /> </a4j:outputPanel>
Thanks for your help!
Willy_Makeit