PDA

View Full Version : How to auto refresh grid content every x ms



gkassyou
6 Apr 2007, 5:32 AM
I have a borderlayout that contains a gridPanel with a grid. I would like to update the grid content every x m.s.

Any ideas, examples would be appreciated.

BernardChhun
6 Apr 2007, 6:18 AM
hmm using an infinite loop in which you reload the DataStore might work:



// the never ending loop that will call itself every second
function timedCount()
{

// call here the function that reloads your grid's DataStore
t=setTimeout("timedCount()",1000)
}

KimH
16 Apr 2007, 2:20 AM
Just remember not to actually update the grid if the data hasn't changed ;) This is for the server to handle using HTTP Response Status Code

tinakonda
19 Jul 2009, 1:42 PM
Hi,
When I am using autorefresh for grid, it refreshes every 3minutes In which case my screen is greyed out with loading mask. Is there any option that grid data is refreshed and updated from server, where End user shouldn't feel that fro mbrowser. .
On a browser I shouldn't see the page refreshign every 3minutes .it greyed out, whcih is annoying.



Thank you,
tina.

Estefan
20 Aug 2009, 2:31 AM
hi tinaKonda.Can you tell please how did you make your grid load the new data addedto the store.i have a grid that is refreshing every few ms but the problem is that it is not showing the new information added.
Regards

dlbjr
20 Aug 2009, 5:22 AM
var ds = new Ext.data.JsonStore({
url: Config.dataURL,
root: 'data',
fields: [
{ name: 'id', type: 'string' },
{ name: 'desc', type: 'string' }
]
});

var g = new Ext.grid.GridPanel({
//You do not want a load mask
//loadMask: { msg: Config.load_mask, store: ds },
viewConfig: { emptyText: 'No data available' },
title: 'My Data',
store: ds,
height: 400,
width: 400,
stripeRows: true,
autoScroll: true,
sm: new Ext.grid.RowSelectionModel({ singleSelect: true }),
cm: new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), {
header: 'id',
dataIndex: 'id',
hideable: false,
sortable: false,
hidden: false,
width: 100
}, {
header: 'desc',
dataIndex: 'desc',
hideable: false,
sortable: false,
hidden: false,
width: 300
}])
});

var task = {
run: function() {
ds.load()
},
interval: 1000 //1 second
}

var runner = new Ext.util.TaskRunner();

runner.start(task);

Estefan
20 Aug 2009, 10:53 PM
Thanks dlbjr i will try it
Best Regards

dlbjr
21 Aug 2009, 4:30 AM
Use a GridView instead of s GridPanel as I suggested if just displaying data. This should run lighter.