webtier@glassfish.java.net

Re: [webtier] f:ajax issue with h:dataTable

From: Jim Driscoll <Jim.Driscoll_at_Sun.COM>
Date: Wed, 18 Feb 2009 13:26:48 -0800

Wouldn't you have to say

<f:ajax execute="move customers" render="customers" />

?

Jim

On 2/17/09 7:49 PM, Derek Hollis wrote:
> I'm trying to use the f:ajax to re-render a datatable when I click on a
> checkbox. When I click the checkbox the table would never re-render, but
> during debug I saw that updateCustomer listener method would be called.
> However if I changed the ajax tag to * <f:ajax execute="move"
> render="customerUpdate" />* to re-render the form, it would work
> perfectly. Any ideas?
>
> *----- Page ------*
> <h:form id="customerUpdate">
> <h:outputStylesheet name="SPMtables.css" />
> <h:dataTable id="customers" binding="#{customerBean.custTable}"
> var="cust" value="#{customerBean.customers}" styleClass="tbl"
> rowClasses="odd, even">
> <h:column>
> <f:facet name="header">
> <h:outputText value="Id" />
> </f:facet>
> <h:outputText value="#{cust.id <http://cust.id>}" />
> </h:column>
> <h:column>
> <f:facet name="header">
> <h:outputText value="Name" />
> </f:facet>
> <h:outputText value="#{cust.name <http://cust.name>}" />
> </h:column>
> <h:column>
> <f:facet name="header">
> <h:outputText value="Move customer" />
> </f:facet>
> <h:selectBooleanCheckbox id="move"
> valueChangeListener="#{customerBean.updateCustomer}"
> value="#{customerBean.frontShelf}">
> * <f:ajax execute="move" render="customers" />*
> </h:selectBooleanCheckbox>
> </h:column>
> </h:dataTable>
> </h:form>
>
>
> *--- CustomerBean ----*
>
> private HtmlDataTable custTable;
> private List<Customer> customers;
>
> public void updateCustomer(final ValueChangeEvent event)
> {
> Customer cust = (Customer) custTable.getRowData();
> customers.remove(cust);
> }
>
>
> --
> Derek Hollis