• 设为首页
  • 收藏本站
  • 积分充值
  • VIP赞助
  • 手机版
  • 微博
  • 微信
    微信公众号 添加方式:
    1:搜索微信号(888888
    2:扫描左侧二维码
  • 快捷导航
    福建二哥 门户 查看主题

    基于ExtJs在页面上window再调用Window的事件处理方法

    发布者: 皮3591 | 发布时间: 2025-8-13 22:33| 查看数: 102| 评论数: 0|帖子模式

    今天在开发Ext的过程中遇到了一个恶心的问题,就是在ext.window页面,点击再次弹出window时,gridpanel中的store数据加载异常,不能正常被加载,会出现缓存,出现该问题,是因为window窗口弹出时,两个window同时存在,并且在两个window交替使用时,需要先将一个窗口关闭,关闭时,会对window的缓存进行清理,这样就能保证store数据的正确加载。分享给大家,供参考。
    1. var actInfoWindow2;
    2. function showCallFlowInfoWindow(flowid, actId) {
    3.   var actWindowHeight1 = window.innerHeight
    4.   || document.documentElement.clientHeight
    5.   || document.body.clientHeight;
    6.   if(null != upldWin && undefined != upldWin && "" != upldWin){
    7.     upldWin.close();
    8.   }
    9.   // 异常活动模型
    10.   Ext.define('callFlowModel', {
    11.     extend: 'Ext.data.Model',
    12.     fields: [{name: 'instance', type: 'string'},
    13.          {name: 'flowName', type: 'string'},
    14.          {name: 'prjName', type: 'string'},
    15.          {name: 'startTime',  type: 'String'}]
    16.   });
    17.    
    18.   callFlowStore = Ext.create('Ext.data.Store', {
    19.     autoLoad : true,
    20.     model : 'callFlowModel',
    21.     proxy : {
    22.       type : 'ajax',
    23.       url : 'subflow.do',
    24.       reader : {
    25.         type : 'json',
    26.         root : 'callFlowList',
    27.         totalProperty : 'total'
    28.       }
    29.     },
    30.     listeners: {
    31.       'beforeload': function (store, op, options) {
    32.         var params = {
    33.           //参数
    34.           flowId : flowid,
    35.           id : actId
    36.         };
    37.         Ext.apply(store.proxy.extraParams, params);
    38.       }
    39.     }
    40.   });
    41.    
    42.   // 绑定数据模型flowColumns
    43.   var callFlowColumns = [
    44.     { text: '实例名', dataIndex: 'instance', width:174 },
    45.     { text: '工程名', dataIndex: 'prjName',width: 174 },
    46.     { text: '工作流名', dataIndex: 'flowName',width: 174 },
    47.     { text: '启动时间', dataIndex: 'startTime',width: 174 }
    48.   ];

    49.   callFlowGrid = Ext.create('Ext.grid.Panel', {
    50.     region : 'center',
    51.     //tbar:querybar,
    52.     id:'callFlowList',
    53.     autoScroll : false,
    54.     border:false,
    55.     //columnLines : true,
    56.     //selModel:selModel,
    57.     //bbar : pageBar,
    58.     columns : callFlowColumns,
    59.     store : callFlowStore,
    60.     loadMask : {
    61.       msg : " 数据加载中,请稍等 "
    62.     }
    63.   });
    64.    
    65.   if (actInfoWindow2 == undefined || !actInfoWindow2.isVisible()) {
    66.     actInfoWindow2 = Ext.create('Ext.window.Window', {
    67.       id : 'actInfoWindow2',
    68.       title : '活动信息详情',
    69.       modal : true,
    70.       closeAction : 'destroy',
    71.       constrain : true,
    72.       autoScroll : true,
    73.       width : 700,
    74.       height : actWindowHeight1 - 300,
    75.       items : [ callFlowGrid ],
    76.       listeners:{
    77.          beforeclose:function(){
    78.            actInfoWindow2.destroy();
    79.          }
    80.       }
    81.     });
    82.   }
    83.   actInfoWindow2.show();
    84. }
    85. if(null != upldWin && undefined != upldWin && "" != upldWin){

    86.   upldWin.close();
    87. }
    复制代码
    我的问题出现就是因为没有添加上面黄色背景的代码片段导致的错误。供大家参考。两个window交替使用时,需要交替关闭,这样才能保证页面的正常。ExtJs不建议弹出多window同时使用,当然,如果能解决好ExtJs之间的数据交互,也未必不可以。
    以上这篇基于ExtJs在页面上window再调用Window的事件处理方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

    来源:互联网
    免责声明:如果侵犯了您的权益,请联系站长(1277306191@qq.com),我们会及时删除侵权内容,谢谢合作!

    最新评论

    QQ Archiver 手机版 小黑屋 福建二哥 ( 闽ICP备2022004717号|闽公网安备35052402000345号 )

    Powered by Discuz! X3.5 © 2001-2023

    快速回复 返回顶部 返回列表