setInterval,在线等
我用ext建立一个js页面,数据都存在store里,想每个3秒自动刷新一下store,总提示我this.store未定义,求高手帮看看,万分感谢。
NSCC.Ext.View_Ctrl_Panel=Ext.extend(NSCC.Ext.ViewPanel,{
control:function()
{
var record=this.grid.getSelectionModel().getSelected();
if(!record)
{
Ext.Msg.alert("提示","请先选择要操作的盘阵!");
return;
}
window.open("http://"+record.get("ip"));
},
initComponent : function()
{
this.myrefresh = Ext.override(Ext.data.Store, {
startAutoRefresh : function(){
setInterval(this.reload(), 1000);
}
});
this.store = new Ext.data.JsonStore({
url: this.baseUrl+'?action=list',
root:"Result",
totalProperty:"totalProperty",
remoteSort:true,
fields:this.storeMapping
});
this.store.paramNames.sort="orderBy";
this.store.paramNames.dir="orderType";
this.cm.defaultSortable=true;
NSCC.Ext.ViewPanel.superclass.initComponent.call(this);
var viewConfig=Ext.apply({forceFit:true},this.gridViewConfig);
this.grid=new Ext.grid.GridPanel
(
{
store: this.store,
cm: this.cm,
trackMouseOver:false,
loadMask: true,
viewConfig:viewConfig,
tbar:
[' ',
{
text: '删除',
pressed: true,
handler: this.removeData,
scope:this
},' ',
{
text: '删除全部',
pressed: true,
handler: this.removeAllData,
scope:this
},' ',
{
text: '添加备注',
pressed: true,
handler: this.addnote,
scope:this
},' ',
{
text: '详细信息',
pressed: true,
handler: this.control,
scope:this
},' ',
{
text: '刷新',
pressed: true,
handler: this.search,
scope:this
},' ',
new Ext.Toolbar.Fill(),
{
xtype: 'textfield',
id:'queryText' + this.getId(),
width: 200,
allowBland :false,
emptyText: "请输入需要查询的IP地址",
listeners: {
'render': {fn:function(){
Ext.getCmp('queryText' + this.getId()).getEl().on('keyup',
function(){
this.search();
},
this,
{buffer:500}
);
},
scope:this}
}
}
],
bbar: new Ext.PagingToolbar
(
{
pageSize: 50,
store: this.store,
displayInfo: true,
plugins: new Ext.ux.ProgressBarPager()
}
)
}
);
this.grid.on("celldblclick",this.edit,this);
this.add(this.grid);
this.store.load({params:{start:0, limit:50}});
setInterval(function () {this.store.reload();}, 3000);
}