今天在開發(fā)Ext的過程中遇到了一個(gè)惡心的問題,就是在ext.window頁面,點(diǎn)擊再次彈出window時(shí),gridpanel中的store數(shù)據(jù)加載異常,不能正常被加載,會(huì)出現(xiàn)緩存,出現(xiàn)該問題,是因?yàn)閣indow窗口彈出時(shí),兩個(gè)window同時(shí)存在,并且在兩個(gè)window交替使用時(shí),需要先將一個(gè)窗口關(guān)閉,關(guān)閉時(shí),會(huì)對(duì)window的緩存進(jìn)行清理,這樣就能保證store數(shù)據(jù)的正確加載。分享給大家,供參考。
var actInfoWindow2; function showCallFlowInfoWindow(flowid, actId) { var actWindowHeight1 = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; if(null != upldWin && undefined != upldWin && "" != upldWin){ upldWin.close(); } // 異常活動(dòng)模型 Ext.define('callFlowModel', { extend: 'Ext.data.Model', fields: [{name: 'instance', type: 'string'}, {name: 'flowName', type: 'string'}, {name: 'prjName', type: 'string'}, {name: 'startTime', type: 'String'}] }); callFlowStore = Ext.create('Ext.data.Store', { autoLoad : true, model : 'callFlowModel', proxy : { type : 'ajax', url : 'subflow.do', reader : { type : 'json', root : 'callFlowList', totalProperty : 'total' } }, listeners: { 'beforeload': function (store, op, options) { var params = { //參數(shù) flowId : flowid, id : actId }; Ext.apply(store.proxy.extraParams, params); } } }); // 綁定數(shù)據(jù)模型flowColumns var callFlowColumns = [ { text: '實(shí)例名', dataIndex: 'instance', width:174 }, { text: '工程名', dataIndex: 'prjName',width: 174 }, { text: '工作流名', dataIndex: 'flowName',width: 174 }, { text: '啟動(dòng)時(shí)間', dataIndex: 'startTime',width: 174 } ]; callFlowGrid = Ext.create('Ext.grid.Panel', { region : 'center', //tbar:querybar, id:'callFlowList', autoScroll : false, border:false, //columnLines : true, //selModel:selModel, //bbar : pageBar, columns : callFlowColumns, store : callFlowStore, loadMask : { msg : " 數(shù)據(jù)加載中,請(qǐng)稍等 " } }); if (actInfoWindow2 == undefined || !actInfoWindow2.isVisible()) { actInfoWindow2 = Ext.create('Ext.window.Window', { id : 'actInfoWindow2', title : '活動(dòng)信息詳情', modal : true, closeAction : 'destroy', constrain : true, autoScroll : true, width : 700, height : actWindowHeight1 - 300, items : [ callFlowGrid ], listeners:{ beforeclose:function(){ actInfoWindow2.destroy(); } } }); } actInfoWindow2.show(); } if(null != upldWin && undefined != upldWin && "" != upldWin){ upldWin.close(); }
我的問題出現(xiàn)就是因?yàn)闆]有添加上面黃色背景的代碼片段導(dǎo)致的錯(cuò)誤。供大家參考。兩個(gè)window交替使用時(shí),需要交替關(guān)閉,這樣才能保證頁面的正常。ExtJs不建議彈出多window同時(shí)使用,當(dāng)然,如果能解決好ExtJs之間的數(shù)據(jù)交互,也未必不可以。
以上這篇基于ExtJs在頁面上window再調(diào)用Window的事件處理方法就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com