ExtJS 4"永远在顶部"窗口

Guy*_*kes 8 extjs

我需要实现Window,它总是在顶部.我怎么能这样做?我用WindowManager的所有尝试都没有给我结果:(

Wil*_*ilk 7

在Ext.window.Window中,有一个名为' modal ' 的属性:将其设置为true.

否则,使用WindowManager来管理您的窗口:在这种情况下,您必须按照以下步骤操作:

  1. 将窗口注册到WindowManager(Ext.WindowManager.register(winId))
  2. 使用bringToFront方法将窗口设置在顶部(Ext.WindowManager.bringToFront(winId))
  3. 最后,使用getActive方法检查顶部的元素(Ext.WindowManager.getActive())

例如:

Ext.create ('Ext.window.Window', {
  title: 'Your window' ,
  width: 300 ,
  height: 300 ,
  html: 'ciao ciao' ,
  modal: true
}).show ();
Run Code Online (Sandbox Code Playgroud)

要么:

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
Run Code Online (Sandbox Code Playgroud)

希望这对你有所帮助.

Cyaz