0 Replies Latest reply on Oct 16, 2008 7:51 AM by Jaseem Ambalangadan

    selectManyCheckbox in dataTable

    Jaseem Ambalangadan Newbie
      Please help me in retrieving the checkbox values.

      MY ACTION CLASS CONTAINS THE FOLLOWING

      public class GroupAction implements Group, Serializable{

      @In(required=false)  @Out(required=false)
      private ObjectsBean objectsBean = null;

      @DataModel
      private List<ObjectsBean> menus;
             
      @DataModelSelectionIndex("menus")
      private int menuIndex;

      @In(required=false)  @Out(required=false)     
      private List<String> selectedItems;     
             
      public List<String> getSelectedItems() {
         return selectedItems;
      }
      public void setSelectedItems(List<String> selectedItems) {
          this.selectedItems = selectedItems;
      }

      public void addGroup() {
         GroupBO groupBO = null;
         groupBO = new GroupBO();
         menus = groupBO.listObjects(em);
      }
      }

      MY BEAN CLASS CONTAINS THE FOLLOWING

      public class ObjectsBean implements Serializable{
             
        private Long objectId = null;
        private String objectName = null;
        private String objectType = null;
        private Long objectPosition = null;
        private Long parentId = null;
        private String objectPermissions = null;
             
        @Transient
        private ArrayList listObjectPermissions = null;

        //...........getters() and setters()........
      }

      MY JSF CONTAINS THE FOLLOWING

      <h:dataTable value="#{menus}" var="objects" class="gridTab">
        <h:column>
          <f:facet name="header">Object Name</f:facet>
          <h:selectManyCheckbox value="#{groupAction.selectedItems}">
             <f:selectItem itemLabel="#{objects.objectName}"
                       itemValue="#{objects.objectName}" />
          </h:selectManyCheckbox>
         </h:column>
         <h:column>
           <f:facet name="header">Permissions</f:facet>
           <h:dataTable value="#{objects.listObjectPermissions}"
                        var="permissions" class="gridTab">
                <h:column>
                   <h:outputLabel value="#{permissions}" />
                </h:column>
           </h:dataTable>
          </h:column>
      </h:dataTable>

      The page displays fine. But I am not in a position to access the selectManyCheckbox values and the itz size shows 0.