4 Replies Latest reply on Oct 22, 2008 6:16 AM by Nick Belaevski

    Size of scrollableDataTable

    Vik Glo Newbie

      HI All,

      I have been struggling with HtmlScrollableDataTable. When I am populating a datatable with more than 1 record, my backing bean gives me expected resutls with the values of selected keys. But when my scrollableDataTable has only one resord in it and I select that only record size of the selection is 'zero' where as it should be 1 as there is atleast one record in my datatable. Below is my code please suggest me what to do about this? My version of richfaces is 3.2.1

      private HtmlScrollableDataTable dataTable;
      private SimpleSelection contactSelection;
      /*The following print statement shows me the right size of selected rows when dataTable has more than 1 records but it it shows the size 0 when datatable has only one record in it*/
      System.out.println(dataTable.getSelection().size())
      Iterator iterator = dataTable.getSelection().getKeys();
      while (iterator.hasNext()){
      Object key = iterator.next();
      dataTable.setRowKey(key);
      mytVO = (MyVO) dataTable.getRowData();
      }
      }

        • 1. Re: Size of scrollableDataTable
          Vik Glo Newbie

          As Expected, no one replied!!

          • 2. Re: Size of scrollableDataTable
            Nick Belaevski Master

            Works for me at 3.2.2.GA:

            <h:form>
             <rich:scrollableDataTable value="#{forum5Bean.data}" selection="#{forum5Bean.selection}">
             <rich:column>
             <h:outputText value="1"></h:outputText>
             </rich:column>
             </rich:scrollableDataTable>
             <a4j:commandButton value="submit" />
             </h:form>


            public Object getData() {
             ArrayList list = new ArrayList();
             list.add(1);
             return list;
             }
            
             private Object selection;
            
             public Object getSelection() {
             return selection;
             }
            
             public void setSelection(Object selection) {
             System.out.println("forum5Bean.setSelection() " + ((SimpleSelection) selection).size());
             this.selection = selection;
             }
            
            


            When I select the first row and press "submit" I see that selection size is written to console properly.

            "vikanglo" wrote:
            As Expected, no one replied!!
            Hmm, why did you expect that no one will reply?

            • 3. Re: Size of scrollableDataTable
              Vik Glo Newbie

              Hi,

              It works for me with 3.2.2 now. I was just trying to find a solution to it. I posted couple of my questions here and no one replied so my expectations were very less. Thanks for your reply.

              • 4. Re: Size of scrollableDataTable
                Nick Belaevski Master

                Ok. I've asked SDT developer to look at two another posts.