Hello,
I'm trying to figure out how to build a proxy that polls the server and updates it's Store. I have a regular proxy working that will make a directFn call and update a store once. How can I do this on an interval?
The examples seems to suggest that I should add a listener to the proxy that fires off a poll event. The listener would then grab the model and update the data. Seems plausible, however I just want to make sure that the easiest way to do this. Shouldn't there simply be a proxy type that will make a direct call on an interval and automatically update its Store?
This works, once. I want it to run every X seconds until i tell it to stop.
Code:
Ext.define('MyApp.model.SummaryAppModel', {
extend: 'Ext.data.Model',
fields: ['name','type','value']
});
Ext.define('MyApp.store.SummaryAppStore', {
extend: 'Ext.data.Store',
requires: [
'MyApp.model.SummaryAppModel'
],
paramsAsHash: false,
idProperty: 'value',
storeId: 'SummaryAppStore',
model: 'MyApp.model.SummaryAppModel',
groupField: 'type',
autoLoad: true,
proxy: {
type: 'direct',
directFn: 'RTSStats.getAppStatsDirect'
}
});
Ext.define('Ext.grid.RTSLeftPanel', {
extend: 'Ext.grid.Panel',
alias: 'widget.rtsleftpanel',
collapsible: false,
iconCls: 'icon-grid',
frame: true,
store: 'SummaryAppStore',
width: 200,
resizable: false,
features: [groupingLeftFeature],
columns: [{
text: 'Field',
flex: 1,
dataIndex: 'name'
},{
text: 'Value',
flex: 1,
dataIndex: 'value'
},{
text: 'Type',
flex: 1,
dataIndex: 'type'
}]
});