ExtJS 4 “always on top” Window

六月ゝ 毕业季﹏ 提交于 2019-12-19 06:11:11

问题


I need to implement Window which can be always on top. How can I to do it? All my tries with WindowManager give me no results :(


回答1:


In Ext.window.Window, there's a property called 'modal': set it to true.

Otherwise, use the WindowManager to manage your windows: in this case you have to follow the following steps:

  1. register your windows to the WindowManager (Ext.WindowManager.register (winId))
  2. use bringToFront method to set your window on top (Ext.WindowManager.bringToFront (winId))
  3. finally, check the element on top with the getActive method (Ext.WindowManager.getActive ())

E.g.:

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

Or:

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

Hope this help you.

Cyaz



来源:https://stackoverflow.com/questions/10433925/extjs-4-always-on-top-window

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!