基于ExtJs在頁面上window再調用Window的事件處理方法
今天在開發(fā)Ext的過程中遇到了一個惡心的問題,就是在ext.window頁面,點擊再次彈出window時,gridpanel中的store數據加載異常,不能正常被加載,會出現緩存,出現該問題,是因為window窗口彈出時,兩個window同時存在,并且在兩個window交替使用時,需要先將一個窗口關閉,關閉時,會對window的緩存進行清理,這樣就能保證store數據的正確加載。分享給大家,供參考。
var actInfoWindow2;
function showCallFlowInfoWindow(flowid, actId) {
var actWindowHeight1 = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
if(null != upldWin && undefined != upldWin && "" != upldWin){
upldWin.close();
}
// 異?;顒幽P?
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 = {
//參數
flowId : flowid,
id : actId
};
Ext.apply(store.proxy.extraParams, params);
}
}
});
// 綁定數據模型flowColumns
var callFlowColumns = [
{ text: '實例名', dataIndex: 'instance', width:174 },
{ text: '工程名', dataIndex: 'prjName',width: 174 },
{ text: '工作流名', dataIndex: 'flowName',width: 174 },
{ text: '啟動時間', 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 : " 數據加載中,請稍等 "
}
});
if (actInfoWindow2 == undefined || !actInfoWindow2.isVisible()) {
actInfoWindow2 = Ext.create('Ext.window.Window', {
id : 'actInfoWindow2',
title : '活動信息詳情',
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();
}
我的問題出現就是因為沒有添加上面黃色背景的代碼片段導致的錯誤。供大家參考。兩個window交替使用時,需要交替關閉,這樣才能保證頁面的正常。ExtJs不建議彈出多window同時使用,當然,如果能解決好ExtJs之間的數據交互,也未必不可以。
以上這篇基于ExtJs在頁面上window再調用Window的事件處理方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
基于ExtJs在頁面上window再調用Window的事件處理方法
下面小編就為大家?guī)硪黄贓xtJs在頁面上window再調用Window的事件處理方法。小編覺得挺不錯的,現在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-07-07
Extjs 繼承Ext.data.Store不起作用原因分析及解決
有關Extjs 繼承Ext.data.Store 不起作用的原因有很多種,接下來與大家分享下,本人遇到的,這個Store寫出來之后 是不會起到作用的,感興趣的朋友可以看下詳細的原因及解決方法2013-04-04

