Announcement

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

    silent periodic updates to data grid

    We have a use case where we want to update the data in grid periodically (every 2 minutes) for some monitoring data on dashboard. I understand that I can call fetchData periodically which will update the data at the set interval. But fetch clear the present data in the grid and shows the spinner and set the new data once arrived. Does smartclient supports more silent version of updating the grid? e.g. put a transparent layer over the grid (to represent the request is going on) where user can still see the previously loaded data once the data is arrived, updates the data silently.

    Now I do understand I can override the fetchData on grid and set the data myself on grid but I think default fetchData on grid do many things like creating ResultSet from the data which then supports client side filtering/sorting etc. But I think the use case in hand is pretty standard one and want to check if you guys have already got covered.

    #2
    Hi asingla,

    since version 5.1/10.1 there is refreshData(), which will do what you want IMHO.

    Best regards
    Blama

    Comment


      #3
      I don't think that's going to work as it does not allow you to pass on any new criterion (e.g. new time periods) to fetch any new data. I have implemented this by defined a new method on the ListGrids as below

      Code:
      // update the data silently
      fetchDataSilently: function() {
          var that = this;
           this.dataSource.fetchData(<anynewcrit>, function(dsResponse, data, dsRequest) {
               dsResponse.operationType = "update"; // ideally one can create a new response object if required
               that.dataSource.updateCaches(dsResponse)
          })                
      }

      Comment


        #4
        refreshData() is the right way to do this, and your approach is far far slower and will generally add a new set of records rather than replace those already there.

        If you need to inject new criteria, you could do so in DataSource.transformRequest().

        Comment

        Working...
        X