Announcement

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

    ListGrid.fetchData() fires executeFetch multiple times

    Hi,

    I'm having a strange problem. I have a databound ListGrid, and a button which simply calls:

    Code:
    grid.invalidateCache();
    grid.fetchData();
    But when the fetchData is executed, the Datasource.executeFetch is fired 3 times. I can't figure it out. This is having the strange effect of duplicate rows being added to the grid.

    For example: the executeFetch fires an RPC which always returns 4 rows. However, because it is fired 3 times, in quick succession, I get some duplicates in the grid:

    Row 1
    Row 2
    Row 3
    Row 4
    Row 1
    Row 2
    Row 3

    I'm at a loss as to why or how this could happen. Has anybody encountered something similar?

    #2
    You don't need to call fetchData() after invalidateCache(), it's automatic.

    As far as those fetches and extra rows appearing, this suggests something is wrong in your startRow/endRow/totalRows values, probably an off-by-one.

    Comment


      #3
      Thanks for the tips. I'll check out the start/end row values...

      Just one thing though: Does invalidateCache always trigger a fetch? I removed the fetchData() and no fetches are performed now.

      I checked the javadocs, they say:
      Code:
      Invalidate the current data cache for this databound component via a call to this.data.invalidateCache(). If necessary, this will cause a new fetch to be performed with the current set of criteria for this component.
      Has no effect if this component is not showing a set of filtered data.
      So does that mean invalidateCache only triggers a fetch when criteria have been set?

      Thanks

      Comment


        #4
        InvalidateCache() will re-fetch if fetchData() has ever been called (more generally, if the grid has a ResultSet).

        Comment

        Working...
        X