Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 763
VAAA Avatar asked Aug 24 '26 00:08

VAAA


1 Answers

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
});
like image 196
Shalev Shalit Avatar answered Aug 26 '26 22:08

Shalev Shalit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!