• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
皎陽
博客园    首页    新随笔    联系   管理    订阅  订阅

store 加载异常处理与加载信息提示

  1.      var msgTip = '';   // 一定要定义在使用前,且定义为全局变量  
  2. /--------------------------------store---------------------------------------------------------------//  
  3. window.panelStore5 = Ext.create('Ext.data.Store', {  
  4.  fields:[{name:'name'},{name:'preStatics',type:'int'},'mypercent'],  
  5.     proxy: {  
  6.        type: 'ajax',  
  7.        url: extPath+'/center!getDetailByType.action?random='+new Date().getTime()+''+'&type=5',  
  8.        reader: {  
  9.            type: 'json',  
  10.            root: 'humresData',  
  11.            totalProperty: 'totalCount'  
  12.         }  
  13.   },  
  14.     autoLoad: false,  
  15.     sorters:[{  
  16.         property:"name",  
  17.         direction:"asc"  
  18.     },{  
  19.         property:"preStatics",  
  20.         direction:"asc"  
  21.       }],  
  22.   listeners:{  
  23.          beforeload:function(store,records,successful,operation,opts){  
  24.                  msgTip = Ext.MessageBox.show({  
  25.                   title:'提示',  
  26.                   width : 250,  
  27.                   msg:'页面统计信息刷新中,请稍后...',  
  28.                   buttons: Ext.Msg.OK  
  29.                   
  30.                  });  
  31.              },  
  32.         load:function(store,records,successful,operation,opts){  
  33.                 if(successful){  
  34.                     Ext.Msg.alert('提示','数据加载成功!');  
  35.                     msgTip.hide();  
  36.                       
  37.                 }else{  
  38.                       
  39.                     Ext.Msg.alert('提示','数据加载失败!');  
  40.                     msgTip.hide();  
  41.                 }          
  42.            }  
  43.   }  
  44. });    
  1. 服务器 返回数值 类似:{ 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 字段

   })

 

posted @ 2016-02-22 19:11  皎陽  阅读(242)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3