8 Replies Latest reply on Feb 26, 2009 5:55 PM by nbelaevski

    ExtendedDataTable  + datascroller

    elf

      Hi

      I use Datascroller with ExtendedDataTable as described here
      http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=editDataTable
      My table height is dynamic depending on screen height. Row count in table should be static. But, scrolling in table does not visible in this case.
      If I run my application on computers with different screen size, I do not see all rows of table on smaller screen size.

      Help me, please. How can I dynamically set up row count in ExtendedDataTable or how can I make scrolling visible ?

        • 1. Re: ExtendedDataTable  + datascroller
          nbelaevski

          Hello,

          Please post page code.

          • 2. Re: ExtendedDataTable  + datascroller
            elf

            here is my code

             private HtmlForm getDefaultList(String listId){
            
             ExpressionFactory elFactory = FacesContext.getCurrentInstance().getApplication().getExpressionFactory();
             ELContext elContext = FacesContext.getCurrentInstance().getELContext();
            
             HtmlExtendedDataTable list = new HtmlExtendedDataTable();
             list.setId(listId);
             list.setValueExpression("value",
             elFactory.createValueExpression(elContext, "#{exListManager.dataModel}", ExtendedTableDataModel.class));
             list.setWidth("100%");
             list.setHeight(getHeight());
             list.setSelectedClass("dataTableSelectedRow");
             list.setSortMode("single");
             list.setSelectionMode("single");
             list.setValueExpression("selection",
             elFactory.createValueExpression(elContext, "#{exListManager.selection}", SimpleSelection.class));
             list.setRowKeyVar("rkvar");
             list.setValueExpression("tableState",
             elFactory.createValueExpression(elContext, "#{exListManager.tableState}", String.class));
             list.setVar("item");
            
             HtmlColumn idCol = new HtmlColumn();
             idCol.setId(listId+"Id");
             ValueExpression idExpr = elFactory.createValueExpression(elContext, "#{item.id}", Long.class);
             idCol.setHeaderClass("dataTableHeader");
             idCol.setLabel("ID");
             idCol.setValueExpression("sortBy", idExpr);
             HtmlOutputText idContent = new HtmlOutputText();
             idContent.setValueExpression("value", idExpr);
             idCol.getChildren().add(idContent);
             HtmlOutputText idHeader = new HtmlOutputText();
             idHeader.setValue("ID");
             idCol.getFacets().put("header", idHeader);
             idCol.setWidth("50px");
             list.getChildren().add(idCol);
            
             HtmlColumn nameCol = new HtmlColumn();
             nameCol.setId(listId+"Name");
             ValueExpression nameExpr = elFactory.createValueExpression(elContext, "#{item.name}", String.class);
             nameCol.setHeaderClass("dataTableHeader");
             nameCol.setLabel("Name");
             nameCol.setSelfSorted(true);
             nameCol.setValueExpression("filterBy", nameExpr);
             nameCol.setValueExpression("sortBy", nameExpr);
             nameCol.setFilterEvent("onkeyup");
             HtmlOutputText nameContent = new HtmlOutputText();
             nameContent.setValueExpression("value", nameExpr);
             nameCol.getChildren().add(nameContent);
             HtmlOutputText nameHeader = new HtmlOutputText();
             nameHeader.setValue("Name");
             nameCol.getFacets().put("header", nameHeader);
             nameCol.setWidth("100%");
             list.getChildren().add(nameCol);
            
             list.getFacets().put("footer", getDatascroller(list));
            
             HtmlForm listForm = new HtmlForm();
             listForm.getChildren().add(list);
            
             return listForm;
            
             }
            
            



             private HtmlDatascroller getDatascroller(HtmlExtendedDataTable list){
             HtmlDatascroller dScr = new HtmlDatascroller();
             dScr.setRenderIfSinglePage(true);
             dScr.setId(list.getId()+ "DataScroller");
             dScr.setBoundaryControls("auto");
             dScr.setMaxPages(Integer.parseInt(UIHelper.getResTuning().getString("data_list_max_page_count")));
             list.setRows(Integer.parseInt(UIHelper.getResTuning().getString("data_list_max_row_count")));
             return dScr;
             }
            
            


            • 3. Re: ExtendedDataTable  + datascroller
              elf

              nbelaevski, Could you please help me with this issue ? What is wrong in my code?

              • 4. Re: ExtendedDataTable  + datascroller
                nbelaevski

                Hi,

                The code does not give much information:
                list.setHeight(getHeight());
                list.setSelectedClass("dataTableSelectedRow");

                Also I do not see number of rows set.

                • 5. Re: ExtendedDataTable  + datascroller
                  elf

                  Number of rows I set in second method
                  list.setRows(Integer.parseInt(UIHelper.getResTuning().getString("data_list_max_row_count")));
                  It is fixed. I get it from text file.
                  Help me please to make number of rows dynamic in table or to make scrollBar visble.

                  • 6. Re: ExtendedDataTable  + datascroller
                    nbelaevski

                    You can do something like this: http://livedemo.exadel.com/richfaces-demo/richfaces/actionparam.jsf?c=actionparam&tab=usage, the 3rd example. Add this to a4j:jsFunction and call it on load, re-rendering data table with the appropriate number of rows.

                    • 7. Re: ExtendedDataTable  + datascroller
                      elf

                      Thank you, good solution.
                      Is non-visible scrollbar in this case issue and if yes, will it be fixed in next version ?

                      • 8. Re: ExtendedDataTable  + datascroller
                        nbelaevski

                         

                        "elf" wrote:
                        Thank you, good solution.
                        Is non-visible scrollbar in this case issue and if yes, will it be fixed in next version ?

                        Scrollbar is ok on demo site: http://livedemo.exadel.com/richfaces-demo/richfaces/extendedDataTable.jsf?c=extendedDataTable&tab=usage. Please create small page reproducing the issue and post the code here. As for now I cannot reproduce the problem.