0 Replies Latest reply on Feb 28, 2009 6:18 AM by Thai Dang Vu

    SimpleSelection doesn't work in Seam

    Thai Dang Vu Apprentice

      I have 2 Seam components:

      public class CustomerListImpl implements CustomerList {
       protected Log log;
       @PersistenceContext(type= PersistenceContextType.EXTENDED)
       protected EntityManager entityManager;
       protected List<Customer> customers;
       @In(value="customerComponents", required=false)
       protected CustomerComponents customerComponents;
       public void viewSelectedRows() {
       Iterator<Object> iterator = customerComponents.getSelection().getKeys();
       while (iterator.hasNext()) {
       Object key = iterator.next();
       Object customer = customerComponents.getDataTable().getRowData();
       customer = null;
       public void findCustomers() {
       customers = entityManager.createQuery("select c from Customer c").getResultList();
       public void goToPanelBarItem() {
       public void destroy() {
      public interface CustomerList {
       void viewSelectedRows();
       void findCustomers();
       void goToPanelBarItem();
       void destroy();
      public class CustomerComponents {
       private HtmlScrollableDataTable dataTable;
       private SimpleSelection selection;
       private HtmlPanelBar panelBar;
       // ... getters & setters

      My xhtml
       <rich:scrollableDataTable value="#{customers}" var="customer" width="70px" height="200px"
       <rich:column width="48px">
       <f:facet name="header">ID</f:facet>
       <h:outputText value="#{customer.id}" />
       <a4j:commandLink value="View Selected Rows" action="#{customerList.viewSelectedRows}"
       reRender="selectedRowBox" />
       <rich:panelBar binding="#{customerComponents.panelBar}" width="500">
       <rich:panelBarItem name="barItem1" label="Leverage the whole set of JSF benefits ...">
       <a4j:support event="onenter" action="#{customerList.goToPanelBarItem}"/>
       Ajax4jsf is fully integrated ...
       <rich:panelBarItem name="barItem2" label="Add AJAX capability...">
       <a4j:support event="onenter" action="#{customerList.goToPanelBarItem}"/>
       The framework is implemented ...
      <h:panelGroup id="selectedRowBox"></h:panelGroup>

      When I select some rows and click View Select Rows, the iterator is always empty.

      When I enter a panel bar item, the goToPanelBarItem method prints the panel bar item name (that means the JSF component bindings work).

      Does anybody know why the selection doesn't work?

      Thank you.