Richfaces 4 datatable rowclick is not hitting the listener method
skunjumohamed Mar 29, 2011 10:26 AMI am migrating an application from richfaces 3 to 4. And I am stuck at the datatable.
The rowclick sends request to server and renders response, but not invoking the listener method. It is not even evaluating the method. I have tried giving a non-existing method name, it still doesn't complain at run time either. I am using the Richfaces 4.0.0 CR1 library.
Anyone has a clue, please help me.
Here is my datatable code.
Datatable |
---|
<rich:dataTable id="customersTable" value="#{customerBean.customerList}" var="customer" rowKeyVar="rowKey"> <a4j:ajax event="rowclick" listener="#{customerBean.makeRowEditable}"> </a4j:ajax> <rich:column> <f:facet name="header"> Id </f:facet> #{customer.id} </rich:column> <rich:column> <f:facet name="header"> Name </f:facet> #{customer.name} </rich:column> </rich:dataTable> |
The backing bean
CustomerBean.java |
---|
package myapp;
import java.util.ArrayList; import java.util.List;
import javax.faces.event.AjaxBehaviorEvent;
import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
public class CustomerBean {
protected Log log = LogFactory.getLog(this.getClass());
private List<Customer> customerList; private Customer selectedCustomer;
public CustomerBean() { log.warn("CustomeBean is instantiated." + this); this.customerList = new ArrayList<CustomerBean.Customer>(); customerList.add(new Customer(1, "One")); customerList.add(new Customer(2, "Two")); customerList.add(new Customer(3, "Three")); customerList.add(new Customer(1, "Four")); }
public List<Customer> getCustomerList() { return customerList; }
public void setCustomerList(List<Customer> customerList) { this.customerList = customerList; }
public Customer getSelectedCustomer() { return selectedCustomer; }
public void setSelectedCustomer(Customer selectedCustomer) { this.selectedCustomer = selectedCustomer; }
public void makeRowEditable(AjaxBehaviorEvent event) { log.warn("CustomerBean. makeRowEditable: "); }
public void selectCustomer(Customer customer) { this.selectedCustomer = customer; log.warn("CustomerBean. selectCustomer: customer = " + customer); }
public void unselectCustomer() { log.warn("CustomerBean. unselectCustomer: "); this.selectedCustomer = null; }
public class Customer { private int id; private String name;
public Customer() { // TODO Auto-generated constructor stub }
public Customer(int id, String name) { super(); this.id = id; this.name = name; }
public int getId() { return id; }
public void setId(int id) { this.id = id; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
}
} |
Thanks in advance for any help.