3 Replies Latest reply on Oct 25, 2009 8:10 PM by Florian Gessner

    extendedDataList: selection not working

    Florian Gessner Newbie


      I try to create a UI which contains a extendedDataList with a detail screen below. When the user selects a table row, the information of this table row should be visible below the table.

      The UI is implemented as follows:

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
           <ui:define name="content">
                <h1>User Management</h1>
                     <f:facet name="header">
                          <h:outputText value="User List:" />
                     <rich:toolBar height="18px" itemSeparator="line">
                               <h:commandButton action="newUser.xhtml" value="Create User" alt="create a new user" />
                               <h:commandButton action="editUser.xhtml" value="Edit User" alt="edit selected user" />
                     <rich:extendedDataTable id="userList" var="user" value="#{users}" rendered="#{not empty users}" sortMode="single"
                          selectionMode="single" selection="#{userList.selection}" rows="10" width="100%">
                          <rich:column label="Id" sortable="true" sortBy="#{user.userId}">
                               <f:facet name="header">
                                    <h:outputText value="Id" />
                               <h:outputText value="#{user.userId}" />
                          <rich:column label="Username" sortable="true" sortBy="#{user.username}">
                               <f:facet name="header">
                                    <h:outputText value="Username" />
                               <h:outputText value="#{user.username}" />
                          <rich:column label="Firstname" sortable="true" sortBy="#{user.firstname}">
                               <f:facet name="header">
                                    <h:outputText value="Firstname" />
                               <h:outputText value="#{user.firstname}" />
                          <rich:column label="Lastname" sortable="true" sortBy="#{user.lastname}">
                               <f:facet name="header">
                                    <h:outputText value="Lastname" />
                               <h:outputText value="#{user.lastname}" />
                          <rich:column label="Active" sortable="true" sortBy="#{user.enabled}">
                               <f:facet name="header">
                                    <h:outputText value="Active" />
                               <h:selectBooleanCheckbox id="Active" title="Active" value="#{user.enabled}" disabled="true" readonly="true" />
                          <rich:column label="Technical User" sortable="true" sortBy="#{user.technicalUser}">
                               <f:facet name="header">
                                    <h:outputText value="Technical User" />
                               <h:selectBooleanCheckbox id="technicalUser" title="technicalUser" value="#{user.technicalUser}" readonly="true" disabled="true" />
                          <a4j:support reRender="userDetails" action="#{userList.onSelect}" event="onSelectionChange" />
                <rich:panel id="userDetails">
                     <f:facet name="header">
                          <h:outputText value="User Details:" />
                     <h:panelGrid columns="2">
                          <h:outputLabel value="Username:" for="username"     style="font-weight:bold" />
                          <h:outputText id="username" value="#{userList.selectedUser.username}" />

      The Backend Bean coding:

      public class UserListCBean implements UserListCLocal {
          UserManagerLocal userManager;
          private List<User> users;
          private User selectedUser;
          private SimpleSelection selection;
          Log log;
          public void queryUserList() {
           users = userManager.getAllUsers();
          public User getSelectedUser() {
           return selectedUser;
          public void setSelectedUser(User selectedUser) {
           this.selectedUser = selectedUser;
          public void onSelect() {
           log.info("Out", "Out");
           if (getSelection() != null && getSelection().getKeys() != null) {
               Iterator<Object> iterator = getSelection().getKeys();
               while (iterator.hasNext()) {
                Object key = iterator.next();          
                Integer i = (Integer) key;
                selectedUser = users.get(i);
          public List<User> getUsers() {
           return users;
          public void setUsers(List<User> users) {
           this.users = users;
          public SimpleSelection getSelection() {
           return selection;
          public void setSelection(SimpleSelection selection) {
           this.selection = selection;
          public void destroy() {}

      and also the Local interface of the backend bean.

      public interface UserListCLocal {
          public void destroy();
          public void queryUserList();
          public User getSelectedUser();
          public void setSelectedUser(User selectedUser);
          public void onSelect();
          public List<User> getUsers();
          public void setUsers(List<User> users);
          public SimpleSelection getSelection();
          public void setSelection(SimpleSelection selection);

      I assume that the a4j action is not executed.
      I user Seam 2.1.2 with JBoss AS 5.0.1.

      Thanks for you help!!

      Best Regards