Extjs4.2 MVC 如何定时刷新GridPanel? 20
extjs4MVC中controller中如何实现store:tech的定时刷新controller代码:Ext.define('head.controller.Head...
extjs4 MVC 中controller中如何实现store:tech 的定时刷新
controller代码:Ext.define('head.controller.HeadController',{ extend:'Ext.app.Controller', views:['List','Edit'], models:['Tech','Bug','Emp'], stores:['Tech','Bug','Emp'], refs:[{ ref:'pageToolBar', selector:'list pagingtoolbar' },{ ref:'list', selector:'list' }], init:function(){ this.control({ 'list button[action=edit]':{ click:this.editTech }, 'list button[action=delete]':{ click:this.deleteTech }, 'edit button[action=edit]':{ click:this.updateTech } }) }, editTech:function(button){ var grid = button.up('grid'); var records = grid.getSelectionModel().getSelection(); if(records.length != 1){ Ext.Msg.alert('提示', '请选择一个工单指派'); return; } var view = Ext.widget('edit'); view.down('form').loadRecord(records[0]); view.show(); } 展开
controller代码:Ext.define('head.controller.HeadController',{ extend:'Ext.app.Controller', views:['List','Edit'], models:['Tech','Bug','Emp'], stores:['Tech','Bug','Emp'], refs:[{ ref:'pageToolBar', selector:'list pagingtoolbar' },{ ref:'list', selector:'list' }], init:function(){ this.control({ 'list button[action=edit]':{ click:this.editTech }, 'list button[action=delete]':{ click:this.deleteTech }, 'edit button[action=edit]':{ click:this.updateTech } }) }, editTech:function(button){ var grid = button.up('grid'); var records = grid.getSelectionModel().getSelection(); if(records.length != 1){ Ext.Msg.alert('提示', '请选择一个工单指派'); return; } var view = Ext.widget('edit'); view.down('form').loadRecord(records[0]); view.show(); } 展开
2个回答
展开全部
最简单的方法,获取到store后,直接使用定时函数:
setInterval(function(){
store.load();
},1000);
也可以使用Extjs封装的任务类
var fresh = function () {
store.load();
}
var runner = new Ext.util.TaskRunner();
var task = runner.start({
run: fresh,
interval: 1000
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询