• 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 字段

       })

  • 相关阅读:
    Atitit. C#.net clr 2.0 4.0 4.5新特性 v2 s22 1. CLR内部结构 1 2. CLR 版本发展史 3 3. CLR 2.0新特性 4 4. CLR 4 新特性
    Hbase基本命令 悟寰轩
    mvn常用命令 悟寰轩
    linux添加tomcat服务 悟寰轩
    hadoop基本命令 悟寰轩
    Tomcat启动 悟寰轩
    Eclipse自动部署项目到Tomcat的webapps下的有效方法 悟寰轩
    MySQL改变默认编码为utf8 悟寰轩
    myeclipse关闭自动更新 悟寰轩
    Linux命令大全 悟寰轩
  • 原文地址:https://www.cnblogs.com/dingjiaoyang/p/5207984.html
Copyright © 2020-2023  润新知