zoukankan      html  css  js  c++  java
  • 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 字段

       })

  • 相关阅读:
    个人笔记 1.3.net 3.5新特性
    个人笔记 1.2.net 2.0新特性
    面试了,web标准能简单说下吗?w3c,,错了
    SEO网络营销热门关键词排名较好的反向链接
    eWebEditor在ie8下上传失效
    个人笔记 1.4.net 3.0新特性
    个人笔记 1.5.http状态值
    MOSS项目开发(5) 会议还是会议
    MOSS项目开发 周记(第二周)
    MOSS项目开发 周记(第五周)
  • 原文地址:https://www.cnblogs.com/dingjiaoyang/p/5207984.html
Copyright © 2011-2022 走看看