PDA

View Full Version : How to auto refresh data grid.



khoivu4477
1 Dec 2009, 1:39 PM
I have a typical problem that some of you have tried to solved before and I need your helps.

I have to develop a web application that show a data grid to the user. The data grid is about Stock performance (3 mos, 6 mos, 1year, 5 year and 10 years). So each row is per stock performance. It is typical CRUD application. I have learned how to use DwrProxy (http://www.extjs.com/forum/showthread.php?t=23884) with Ext JS grid and now I am facing my next challenge: to make the grid auto refresh with new stock performance every minute (this interval is configurable).

Question: can ext js grid trigger any timeout events that make the DataStore to fetch for updated data from the server?

I appreciate if someone can help to show me the right directions or any ideas on how I can achieve this.

Thanks

-K

husniadil
1 Dec 2009, 1:52 PM
use


setTimeout('yourDataStore.reload();', 60000); // 60000 = 1 minute
becareful, yourDataStore should be accessed globally...
I wonder if you defined yourDataStore inside onReady function..
place the variable definition of yourDataStore is outside of onReady function..

khoivu4477
1 Dec 2009, 7:45 PM
I will try your suggestion. Thanks

LutzAlbers
1 Dec 2009, 10:02 PM
use


setTimeout('yourDataStore.reload();', 60000); // 60000 = 1 minute
becareful, yourDataStore should be accessed globally...
I wonder if you defined yourDataStore inside onReady function..
place the variable definition of yourDataStore is outside of onReady function..

If you use the following construct then you don't need to globally define the datastore:


setTimeout(function() { yourDataStore.reload(); }, 60000);

husniadil
1 Dec 2009, 11:55 PM
that's good idea :)