Search code examples
extjsextjs4extjs4.1extjs4.2

ExtJS interval timer get data and insert new rows in grid


I have my ExtJS 4.2 Application with a grid that initially will load and display data from a database table.

On server side, this table have new data about every 10 seconds, so I want to have a Ext.TaskRunner that every 10 senconds will go again to my WebService, get new data and insert it to the grid.

So, I dont want to get all data from server, just the new one. That's why I need to know how to do this with ExtJS. TaskRunner and grid (inserting new rows).

Hope someone can help me.


Solution

  • this is how the function should be

    Ext.TaskManager.start({
      run: function(){
        // Ajax request with store.add()
        // OR store.load({addRecords: true}) as @Evan Trimboli said
        // also you can add start parameter store.load({start: store.count()})
      },
      interval: 10000
    });