//异常车次率
motorErrorFunc:function(node,event){
console.log("异常车次率");
console.log(node);
console.log(node.previousNode("lineoverview"));
var lineOverView = node.previousNode("lineoverview"); //获取当前节点之前的第一个xtype为lineoverview的component对象
var subView = Ext.getCmp('smartdispatchsubview'); //根据id获取对象
//console.log(subView);
//alert(subView.getScrollY())
//遍历当前的窗口集合 若存在则激活当前窗口 不存在则创建一个加入集合
var title = '<span style="color:#e44959;">'+lineOverView.title+' 异常车次'+'</span>';
var tempWin = null;
Ext.each(lineDetailWinList,function(win,index){
console.log(win);
console.log(index);
if(title == win.title)
tempWin = win;
});
//若存在则前置显示
if(tempWin){
//alert("getScrollY "+subView.getScrollY()+" getY "+subView.getY()+" getLocalY "+subView.getLocalY());
var y = subView.getScrollY()==0? 150:subView.getScrollY()+30;
tempWin.setLocalY(y);
tempWin.toFront();
return;
}
var newWin = Ext.create('Ext.window.Window', {
title: title,
height: 300,
width: 600,
cls: 'lineOverviewErrorWindow',
iconCls: 'fa fa-bus lineOverviewErrorWindowBus',
layout: 'fit',
maximizable: true,
draggable: true,
constrain: true,
constrainHeader: true,
renderTo: 'dispatchlineview',
//anchor: "-10 -10",
//x: (Ext.Element.getViewportWidth()-700)/2 + 30*lineDetailWinSize,
//y: (Ext.Element.getViewportHeight()-500)/2+20 + 30*lineDetailWinSize,
x: 100+ 30*lineDetailWinSize,
y: subView.getScrollY()+30+ 30*lineDetailWinSize,
items: { // Let's put an empty grid in just to illustrate fit layout
xtype: 'panel',
border: false,
html: 'some information about '+title
//columns: [{header: 'World'}], // One header just for show. There's no data,
//store: Ext.create('Ext.data.ArrayStore', {}) // A dummy empty data store
},
destroy:function(panel,eOpts){
console.log(panel);
console.log(eOpts);
console.log(this);
//从集合中移除当前的窗口
Ext.Array.remove(lineDetailWinList,this);
//this.callParent(arguments);
lineDetailWinSize = lineDetailWinSize - 1 > 0 ?lineDetailWinSize - 1:0;
}
});
newWin.show();
lineDetailWinList.push(newWin);
lineDetailWinSize = lineDetailWinSize + 1 < 5 ?lineDetailWinSize + 1:10;
}
---------------------------------------------------------------------------------------------
//panel的tools属性,可以添加一些工具按钮
tools:[
{
type: 'maximize',
tooltip: '查看详情',
handler: function(event, toolEl, panelHeader){
//alert("click the button 查看详情");
//alert("创建一个window对象..."); // dispatchlineview
var subView = Ext.getCmp('smartdispatchsubview');
//console.log(subView);
//alert(subView.getScrollY())
//遍历当前的窗口集合 若存在则激活当前窗口 不存在则创建一个加入集合
var title = panelHeader.title.text+' 详情';
var tempWin = null;
Ext.each(lineDetailWinList,function(win,index){
console.log(win);
console.log(index);
if(title == win.title)
tempWin = win;
});
//若存在则前置显示
if(tempWin){
//alert("getScrollY "+subView.getScrollY()+" getY "+subView.getY()+" getLocalY "+subView.getLocalY());
var y = subView.getScrollY()==0? 150:subView.getScrollY()+30;
tempWin.setLocalY(y);
tempWin.toFront();
return;
}
var newWin = Ext.create('Ext.window.Window', {
title: title,
height: 300,
width: 600,
iconCls: 'fa fa-bus',
layout: 'fit',
maximizable: true,
draggable: true,
constrain: true,
constrainHeader: true,
renderTo: 'dispatchlineview',
//anchor: "-10 -10",
//x: (Ext.Element.getViewportWidth()-700)/2 + 30*lineDetailWinSize,
//y: (Ext.Element.getViewportHeight()-500)/2+20 + 30*lineDetailWinSize,
x: 100+ 30*lineDetailWinSize,
y: subView.getScrollY()+30+ 30*lineDetailWinSize,
items: { // Let's put an empty grid in just to illustrate fit layout
xtype: 'panel',
border: false,
html: 'some information about '+title
//columns: [{header: 'World'}], // One header just for show. There's no data,
//store: Ext.create('Ext.data.ArrayStore', {}) // A dummy empty data store
},
destroy:function(panel,eOpts){
console.log(panel);
console.log(eOpts);
console.log(this);
//从集合中移除当前的窗口
Ext.Array.remove(lineDetailWinList,this);
//this.callParent(arguments);
lineDetailWinSize = lineDetailWinSize - 1 > 0 ?lineDetailWinSize - 1:0;
}
});
newWin.show();
lineDetailWinList.push(newWin);
lineDetailWinSize = lineDetailWinSize + 1 < 5 ?lineDetailWinSize + 1:10;
}
}
],
[Extjs6]随记--创建window窗体对象
最新推荐文章于 2021-06-04 05:36:55 发布