我需要实现可以始终位于顶部的 Window。我该怎么做?我对 WindowManager 的所有尝试都没有结果:(
			
			15012 次
		
1 回答
            8        
        
		
在 Ext.window.Window 中,有一个名为“ modal ”的属性:将其设置为 true。
否则,请使用WindowManager管理您的窗口:在这种情况下,您必须按照以下步骤操作:
- 将您的窗口注册到 WindowManager ( Ext.WindowManager.register (winId) )
- 使用bringToFront方法将窗口设置在顶部(Ext.WindowManager.bringToFront (winId))
- 最后,使用getActive方法(Ext.WindowManager.getActive ())检查顶部的元素
例如:
Ext.create ('Ext.window.Window', {
  title: 'Your window' ,
  width: 300 ,
  height: 300 ,
  html: 'ciao ciao' ,
  modal: true
}).show ();
或者:
var win1 = Ext.create ('Ext.window.Window', {
  title: 'Your window' ,
  id: 'firstWin' ,
  width: 300 ,
  height: 300 ,
  html: 'ciao ciao' ,
});
win1.showAt (50, 50);
var win2 = Ext.create ('Ext.window.Window', {
  title: 'Your window' ,
  id: 'secondWin' ,
  width: 300 ,
  height: 300 ,
  html: 'I love pizza' ,
});
win2.showAt (60, 60);
// Register your floating objects (window in this case) to the WindowManager
Ext.WindowManager.register (win1);
Ext.WindowManager.register (win2);
// Bring 'firstWin' on top
Ext.WindowManager.bringToFront ('firstWin');
// Then, check the zIndexStack
alert (Ext.WindowManager.getActive().getId ()); // this is firstWin, the window with the highest zIndex
希望这对您有所帮助。
恰兹
于 2012-05-06T13:33:15.220   回答