Announcement

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

    FetchDataHandler and invalidateCache

    If I have a FetchDataHandler via addFetchDataHandler, should it be called as a result of ListGrid invalidateCache being called?

    A fetch is being performed when invalidateCache is being called but my handler is not invoked in this situation.

    In general (I know it is hard to answer as it may depend on the situation), but if I want to cause a refetch of the data, should I call invalidateCache or fetchData?

    Thanks.

    I am using SmartClient Version: v9.1p_2014-06-04/Pro Deployment (built 2014-06-04)
    Last edited by stonebranch1; 12 Jun 2014, 14:00.

    #2
    The fetchDataHandler is invoked only from calls to fetchData / filterData (including both programmatic calls, and calls tripped by the user interacting with the filter-editor for a grid).
    It isn't tripped from a call to "invalidateCache()".

    To answer your more general question - fetchData / filterData will modify the criteria applied to the grid and display the results. These methods are carefully written to avoid fetching against the dataSource [typically a server fetch] unless necessary.

    So if you've already performed a fetch and the criteria are unchanged, no new fetch.
    If the criteria have been made more restrictive, and you already have a full cache of data for the current criteria, a filter can be performed purely on the client against the existing cached data. So again no fetch (this is instead handled by a local filter within the ResultSet).
    However in other cases, including the first call to "filterData()" / "fetchData()", a fetch against the dataSource is necessary and will be performed.

    By comparison invalidateCache simply tells the ResultSet to throw away its current data set and request a new set of records (matching the current criteria) from the dataSource.

    The appropriate method for you to use will vary based on your application requirements of course.

    Regards
    Isomorphic Software

    Comment


      #3
      Thanks for the clarification.

      Comment

      Working...
      X