3 Replies Latest reply on May 16, 2008 3:12 PM by james holder

    looking for _quick_ sorting scrollabledatatable OR fixedhead

    james holder Newbie

      All,
      I'm currently looking at 3.2.1-CR4, and most of it looks pretty good. The problem I've run into is that I like the implementation of the scrollabledatatable, with only two exceptions:

      1) the sort _speed_
      2) using id="uid" rather than sortBy="#{record.uid}"

      To sort 20 records, it took longer than it should have, to sort 200...... my browser crashed before it could sort them all...

      Sooo what I'm looking for is someway to shift the sort from the client side, to the server side (i believe thats what scrollabledatatable is doing), so that it is as fast as sorting with rich:datatable

      OR

      Someway to reliably get a fixed header on a regular datatable. I don;t need the headers to be resized or any of the number of features that scrollabledatatable has, and the CSS and DHTML scrolling solutions (that I could add to datatable) seem to be universally fragile.

      Any help would be appreciated

        • 1. Re: looking for _quick_ sorting scrollabledatatable OR fixed
          Ilya Shaikovsky Master

          1) Our demosite has about 120 items in the table. If the sorting crashed your browser?
          2) Sorting doesn't performed at client side. All sorting operations in this component performed at server.
          3) resizing could not be turned off right now. Feel free to fill the request.

          • 2. Re: looking for _quick_ sorting scrollabledatatable OR fixed
            james holder Newbie

            After reading your post, I took a look at the example again, and it was sorting faster than my example with a 1/3 less rows.. So I decided to do a test.

            WinXP
            weblogic10
            jsf1.2
            richfaces 3.2.1CR4
            Facelets
            IE6

            Bean/model code

            public class TestObject{
             private String firstName;
             private String lastName;
            
             public String getFirstName() {
             return firstName;
             }
            
             public void setFirstName(String firstName) {
             this.firstName = firstName;
             }
            
             public String getLastName() {
             return lastName;
             }
            
             public void setLastName(String lastName) {
             this.lastName = lastName;
             }
             }
            
            
             private List<TestObject> names;
            
             public List<TestObject> getNames() {
             if(this.names==null){
             this.names = new ArrayList();
             for(int i=0;i<500;i++){
             TestObject to = new TestObject();
             to.setFirstName("First:"+i);
             to.setLastName("Last:"+i);
             this.names.add(to);
             }
            
             }
             return names;
             }
            


            in the page itself:
            
            <h:form id="viewReportForm">
            <rich:scrollableDataTable
             var="item"
             value="#{bean.names}"
             id="reportItemsTable"
             sortMode="single"
             >
            
             <rich:column id="firstName">
             <f:facet name="header">
             <h:outputText
             value="Name"
            >
             </f:facet>
             <h:outputText value="#{item.firstName}"/>
             </rich:column>
            
            </rich:scrollableDataTable>
            
            </h:form>
            
            


            This setup, with 500 elements, and a single colum, took 1 minute and 5.5 seconds to complete a sort. (sorting + rendering)

            Am I doing something wrong? leaving out an a4j:region or something?

            Thanks for your help.


            • 3. Re: looking for _quick_ sorting scrollabledatatable OR fixed
              james holder Newbie

              Ok, after running some more tests, the slowness rests completely on IE's shoulders for rerendering the table. The sort is still super speedy, the slowdown comes when it tries to render. In my example, i was asking for it to load all the rows (rather than make ajax requests to get the table data on scroll). Lowering this to rows="50" is about as slow as I'm willing to let it go, and that works ok, sorting in just a few seconds.

              Honestly what I'm looking for is rich:dataTable functionality, with a fixed header row. I've tried some CSS tricks, to make the dataTable render with fixed headers, but they tend to be extremely fragile.

              I'm guessing that scrollabldatatable build the table body rows one at a time, explaining the extreme slowness when it tries to build more than 100 rows at once. It would be awesome if there was someway to tell it to just rerender the entire table body as as solid chunk of HTML, rather than relying on the DOM to add and remove those rows.

              Does anyone have any suggestions for how to get strictly visual scrolling on a rich:dataTable?