0 Replies Latest reply on Sep 21, 2011 5:28 AM by galvarez

    RF4 ExtendedDataTable AJAX (clientRows) issues

    galvarez

      Hi there,

       

          For some time I've been struggling with the ajax updates of the ExtendedDataTable from an Hibernate database. I had some success, but I also had some problems. I'll show you my code first (please, note that for the bean I'm using Lombok, that works like charm, btw):

       

      Bean:

       

      {code}

      @ManagedBean

      @SessionScoped

      @Entity

      @Table(name = "FARO_BRAND")

      public class Brand implements Serializable

      {

       

       

          /**

                 *

                 */

          private static final long serialVersionUID = -8061201979519160070L;

       

       

          @Getter

          @Setter

          @Column(name="NAME", nullable=false, length=20)

          private String name;

       

       

          @Getter

          @Id

          @Column(name="ID", nullable=false)

          private int id;

       

       

          public Brand()

          {

                    this.id=0;

                    this.name="";

          }

       

      }{code}

       

       

      DAO:

       

      {code}

      @ManagedBean(name="brandSequenceDataModel")

      public class BrandSequenceDataModel extends SequenceDataModel<Brand> {

       

                public BrandSequenceDataModel()

                {

                          super(new ListDataModel<Brand>());

       

                }

       

                @PostConstruct

                public void initialize()

                {

                          Session session = HibernateUtil.getSessionFactory().openSession();

                          Criteria criteria = session.createCriteria(Brand.class);

                          this.setWrappedData(criteria.list());

                }

      }

      {code}

       


       

      Web:

       

      {code:xml}

      <rich:extendedDataTable style="height:300px; width:320px;"

        value="#{brandSequenceDataModel}" var="item"

        rowClasses="even-list-row,odd-list-row" clientRows="20">

          <rich:column>

            <f:facet name="header">

               <h:outputText value="ID" />

            </f:facet>

            <h:outputText value="#{item.id}" />

          </rich:column>

          <rich:column>

            <f:facet name="header">

               <h:outputText value="NAME" />

            </f:facet>

            <h:outputText value="#{item.name}" />

          </rich:column>

      </rich:extendedDataTable>

      {code}

       

       

          Ok, so, these are my problems:

      • Whenever the visitor loads from the database new rows, they are shown always with the even-list-row class. No matter what I do. First update it works, later on, it fails.
      • It only matters the number in clientRows for the first update from the database, afterwards it gets only just as many as *needed* to show on table and *some* more. I mean, if I set the clientRows argument to 50, I expect that every time the visitor goes to the DataModel it gets another 50, but it is not the case.
      • No matter what I do, the update is horribly slow. I guess there is no way to change this, though.
      • Tag API Documentation doesn't show the clientRows parameter. I know, this is not exactly a problem, but I just wanted to point it out

       

         I am using RF 4.0.0 Final version. Anyhow, if you happend to find any other problem in my code (as I am sure you will) I will be very happy to read about it.

       

      Thanks a lot to all.

       

      PS: It would be great to be able to preview this post before sending it