Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Custom DataSource

    Hello,
    I have a custom data source where I am using the DSProtocol.CLIENTCUSTOM and DSDataFormat.CUSTOM. This custom datasource appears to be malfunctioning (or something is) with paginated data.

    My custom data source extends DataSource and overloads transformRequest() to examines the pagination data getStartRow() and getLength() to determine how many rows to retrieve. This data source is bound to a ListGrid.

    After retrieving the data rows, I instantiate a DSReponse object, set it's setData(), setStartRow(), setEndRow(), setTotalRows(), and setStatus() properties and pass that object to the processResponse() method.

    All seems to work great, the ListGrid has the total number of rows displayed correctly and contains actual data for StartRow/EndRow.

    The problem occurs when I scroll past the retrieved result set, the next page of data is never requested. I can't figure out why, any help would be appreciated.

    Thanks
    -Sean

    #2
    TotalRows is the total number of rows in the entire, unpaged data. Start/End control the small page being returned. TotalsRows only matches the Start/End segment if that is the entire block of data.

    Comment


      #3
      Yup, I understood that. I guess the point I was trying to make is that the List grid correctly had 500 total rows, and only 75 of them with actual data values. When I attempted to scroll rows 76+ into view, the request for 76 - 150 was never requested by the SmartGWT framework, IE: the transformRequest() method was never called again....?

      Comment


        #4
        Then what exactly are the start, end and totalrows values you are setting on that first response? You can enable the cache logging by setting ResultSet logging to Debug in the SC developer console. That will tell you what the framework thinks is going on in the cache.

        Comment


          #5
          Arg, I figured it out! It had to do with my transformRequest() overload implementation. I guess I didn't understand the JavaDocs very well, and I wasn't sure what type of Object should be returned from this method. I assumed I could return anything and it would be ignored because I was using CLIENTCUMSTOM protocol. I was wrong!

          My implementation of "public Object transformRequest(DSRequest r)" was returning the "r", or the value passed into it. Again, I still don't know what the return value is used for.

          Upon examining the source code for DataSource, I noticed it was returning r.getJsObj(), so I did the same and all is well now.

          If you have any insight into this, I would be curious.

          Thanks
          -Sean

          Comment

          Working...
          X