-
AutoRefreshing Grid?
Hello,
I want autorefreshing (ex. every 1 minutes) on GridPanel:
GridPanel code:
PHP Code:
var w = new Ext.grid.GridPanel({
store: store,
columns: [
{header: 'numbs', width: 100, sortable: true, dataIndex: 'name'},
{header: 'txt', width: 100, sortable: true, dataIndex: 'position'},
{header: 'dt', width: 250, sortable: true, dataIndex: 'ambition'}
],
stripeRows: true,
height:250,
width:400,
collapsible:true,
region:'west',
split: true,
title:'newnumb',
trackMouseOver: true,
autoload: true,
bbar: new Ext.PagingToolbar({
pageSize: 10, // data to display
store: store,
displayInfo: true,
displayMsg: 'Show {0} - {1} / {2}',
emptyMsg: "-"
})
});
In New.Viewport I have this in items:
-
take a look at the Ext.TaskMgr class
-
It doesn't work. Show me example solution. I want autoreload w.show() function in viewport code:
Code:
new Ext.Viewport({
layout: 'border',
defaults: {
height: 90,
width: 150
},
items: [
{
title: 'titletest',
region: 'center',
/*autoLoad: {url: 'fetchnew.php', scope: this},*/
split: true,
layout: 'auto',
items: [{
title: 'first',
html: 'The first tab\'s content. Others may be added dynamically',
border: true,
split: true,
collapsible: true
},
{
title: 'second',
html: 'The first tab\'s content. Others may be added dynamically',
border: true,
split: true,
collapsible: true
}
]
},
{
title: 'Status',
region: 'south',
split: true,
collapsible: true
},
w.show(),
{
title: 'Easst',
region: 'east',
split: true,
collapsible: true
}
]
});
And GridPanel is shown:
PHP Code:
var w = new Ext.grid.GridPanel({
store: store,
columns: [
{header: 'numbs', width: 100, sortable: true, dataIndex: 'name'},
{header: 'tyt', width: 100, sortable: true, dataIndex: 'position'},
{header: 'dt', width: 250, sortable: true, dataIndex: 'ambition'}
],
stripeRows: true,
height:250,
width:400,
collapsible:true,
region:'west',
split: true,
title:'Novi brojevi',
trackMouseOver: true,
autoload: true,
interval: 1000,
bbar: new Ext.PagingToolbar({
pageSize: 10, // data to display
store: store,
displayInfo: true,
displayMsg: 'Show {0} - {1} / {2}',
emptyMsg: "-"
})
});
-
Here try this.
Code:
var west = new Ext.grid.GridPanel({
store: new Ext.data.SimpleStore({
autoDestroy: true,
autoLoad: true,
data: [['Bob', 'CEO', 'Good']],
fields: ['name', 'position', 'ambition']
}),
columns: [
{header: 'numbs', width: 100, sortable: true, dataIndex: 'name'},
{header: 'tyt', width: 100, sortable: true, dataIndex: 'position'},
{header: 'dt', width: 250, sortable: true, dataIndex: 'ambition'}
],
stripeRows: true,
margins: '0 0 0 0',
height:250,
width:400,
collapsible:true,
region:'west',
split: true,
title:'Novi brojevi'
});
Ext.onReady(function(){
var vp = new Ext.Viewport({
layout: 'border',
items: [{
title: 'titletest',
region: 'center',
/*autoLoad: {url: 'fetchnew.php', scope: this},*/
margins: '0 0 0 0',
layout: 'fit',
items: []
},
west]
});
var task = {
run: function(){
// Reload the grid's store
//west.store.reload();
// Refresh the grid's view
west.getView().refresh();
console.log("I just refreshed the Grid View");
},
interval: 5000 // Every 5 seconds the grid's view will refresh.
}
Ext.TaskMgr.start(task);
});