store 加载异常处理与加载信息提示
2024-10-18 14:57:00
- var msgTip = ''; // 一定要定义在使用前,且定义为全局变量
- /--------------------------------store---------------------------------------------------------------//
- window.panelStore5 = Ext.create('Ext.data.Store', {
- fields:[{name:'name'},{name:'preStatics',type:'int'},'mypercent'],
- proxy: {
- type: 'ajax',
- url: extPath+'/center!getDetailByType.action?random='+new Date().getTime()+''+'&type=5',
- reader: {
- type: 'json',
- root: 'humresData',
- totalProperty: 'totalCount'
- }
- },
- autoLoad: false,
- sorters:[{
- property:"name",
- direction:"asc"
- },{
- property:"preStatics",
- direction:"asc"
- }],
- listeners:{
- beforeload:function(store,records,successful,operation,opts){
- msgTip = Ext.MessageBox.show({
- title:'提示',
- width : 250,
- msg:'页面统计信息刷新中,请稍后...',
- buttons: Ext.Msg.OK
- });
- },
- load:function(store,records,successful,operation,opts){
- if(successful){
- Ext.Msg.alert('提示','数据加载成功!');
- msgTip.hide();
- }else{
- Ext.Msg.alert('提示','数据加载失败!');
- msgTip.hide();
- }
- }
- }
- });
- 服务器 返回数值 类似:{ success:true,humerdata:{name:'andy',password:123123} } //humerdata 为root
2.store 遍历二种方式
stroe.each(function(rec){
alert(rec.get('name'));//name 为fields 字段
or: alert(rec.data.name)//name 为fields 字段
})
最新文章
- 【译】Spring 4 @Profile注解示例
- RestoreDirectory 引起的BUG
- ecshop去掉“云服务中心”或者是“模板堂知识库”
- Swing(一):JFrame框架窗体
- Caffe-windows上训练自己的数据
- blockUI
- int.TryParse 与 int.Parse 的区别
- ASP.NET MVC:01理解MVC模式
- ConcurrentHashMap源码分析
- Github+Hexo,搭建专属网站
- php的数据访问和封装运用
- Chrome浏览器扩展开发系列之九:Chrome浏览器的chrome.alarms.* API
- JAVA中java.util.Date、java.sql.Timestamp和String之间的互相转换
- 三种方式打印杨辉三角形(JAVA实现)
- jqgrid 时间戳转换成日期格式
- 【代码笔记】Web-ionic tab(选项卡)
- openssl版本升级操作记录【转】
- c++ getline()和get()的区别
- tomcat运行内存溢出问题
- 级联sql