webtier@glassfish.java.net

f:ajax issue with h:dataTable

From: Derek Hollis <dthollis_at_gmail.com>
Date: Tue, 17 Feb 2009 22:49:40 -0500

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}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Name" />
                            </f:facet>
                            <h:outputText value="#{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