webtier@glassfish.java.net

Re: [webtier] JSF 2.0: re-render a dataTable with Ajax ?

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Wed, 13 Jan 2010 13:18:40 -0500

Or reload the entire page/data structure.

Lincoln Baxter III
http://ocpsoft.com
http://scrumshark.com
Keep it simple.

On Jan 13, 2010 1:10 PM, "Celinio Fernandes" <papouasied_at_yahoo.com> wrote:

Hi,
I found several posts dealing with my problem :
http://forums.java.net/jive/thread.jspa?messageID=332548
http://forums.java.net/jive/thread.jspa?messageID=373960

None gives answers unfortunately.

My problem is simple : I have a dataTable which contains a list of products,
the last column has a link to delete a product.

  <h:form id="Form1">

 <h:dataTable value="#{myBean.myList}" id="dataTable1" ...>
 <h:column>
  ...
 </h:column>
 ...
  <h:column>
 <h:commandLink value="update" action="#{myBean.delete}" >
                   <f:ajax execute="@this" render=":Form1:dataTable1" />
                <f:param name="id" value="#{product.productid}"/>
 </h:commandLink>
 </h:column>
    </h:dataTable>

 </h:form>

My delete method looks like this :
 public void delete() {
        FacesContext context = FacesContext.getCurrentInstance();
        Map<String, String> params =
context.getExternalContext().getRequestParameterMap();
        String idNumber = params.get("id");
        myEJB.delProduct(idNumber);
    }


It deletes the product. However it does not re-render the dataTable. What am
i missing ?
What value should the render attribute be set to in that case ?

Thanks in advance for helping.