var e = Ext.get('testRefresh'); //取得id属性值'testRefresh'的span元素引用
var mgr = e.getUpdater(); //创建该span元素的UpdateManager实例
mgr.disableCaching = true; //关闭内容cache,否则会取cache中的内容,而不会刷新
mgr.showLoadIndicator = false;
mgr.on('beforeupdate',function(el){
e.fadeOut(); //淡出
});
mgr.on('update',function(el, response ){
e.fadeIn(); //淡入
var doc = response.responseText; //得到action的返回内容
Ext.get( "testRefresh" ).dom.innerHTML = doc; //更新span元素的内容(加粗、斜体)
});
mgr.startAutoRefresh(
2, //每隔2秒刷新一次
"http://127.0.0.1:8088/presence/testRefresh.php", //一个struts action,从后台取出新的数值,并以xml格式返回
null,
true
);
var mgr = e.getUpdater(); //创建该span元素的UpdateManager实例
mgr.disableCaching = true; //关闭内容cache,否则会取cache中的内容,而不会刷新
mgr.showLoadIndicator = false;
mgr.on('beforeupdate',function(el){
e.fadeOut(); //淡出
});
mgr.on('update',function(el, response ){
e.fadeIn(); //淡入
var doc = response.responseText; //得到action的返回内容
Ext.get( "testRefresh" ).dom.innerHTML = doc; //更新span元素的内容(加粗、斜体)
});
mgr.startAutoRefresh(
2, //每隔2秒刷新一次
"http://127.0.0.1:8088/presence/testRefresh.php", //一个struts action,从后台取出新的数值,并以xml格式返回
null,
true
);
ExtJS自动刷新示例
本文介绍如何使用ExtJS库实现页面元素的自动刷新功能。具体步骤包括获取页面元素引用、创建UpdateManager实例并配置参数、设置定时刷新及处理前后台交互等。适用于希望了解ExtJS中动态内容更新机制的前端开发者。
903

被折叠的 条评论
为什么被折叠?



