2012-05-03 17 views
8

Necesito implementar Window que siempre puede estar arriba. ¿Cómo puedo hacerlo? Todos mis intentos con WindowManager me dan ningún resultado :(ExtJS 4 "siempre en la parte superior" Ventana

+0

Tener un vistazo a esto: http://stackoverflow.com/questions/6053847/how-to-make-a-full-modal-window-in-ext-4 – Dave

+1

Echa un vistazo a 'Método Ext.ZIndexManager.bringToFront()' –

+0

Compruebe esto. http://docs.sencha.com/extjs/5.1.0/api/Ext.window.Window.html#cfg-alwaysOnTop –

Respuesta

7

En Ext.window.Window, hay una propiedad llamada ' modal':. Es true

De lo contrario, utilice el WindowManager para gestionar sus ventanas: en este caso, hay que seguir los siguientes pasos:

  1. registro sus ventanas para el gestor de ventanas (Ext.WindowManager.register (winId))
  2. uso BringToFront método para fijar la ventana en la parte superior (Ext.WindowManager.bringToFront (winId))
  3. por último, comprobar el elemento en la parte superior con el método degetActive (Ext.WindowManager.getActive ())

Ej:

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

O:

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 

Espero que esto te ayude.

Cyaz

+0

Eso es bueno, y la ** pregunta principal ** es: ** CÓMO ** detectar esa nueva ventana se muestra en mi ventana? –

+0

Ah, ahora lo tengo;) Bueno, primero tienes que registrar tus ventanas en WindowManager. Luego, verifique zIndexStack del WindowManager;) El primer elemento de la pila es aquel con el índice z más alto. Ext.WindowManager.zIndexStack [0] es su solución, pero creo que lo mismo debe hacer Ext.WindowManager.getActive() pero en mis experimentos no funciona ... Ahora mire mi primera respuesta con la solución completa: está recién editada;) – Wilk

+1

Ok, acabo de entender cómo obtener la ventana con el zIndex más alto a través de Ext.WindowManager.getActive(): en lugar de utilizar el método toFront() de cada ventana, debe usar Ext. WindowManager.bringToFront (id/object) y luego verifíquelo con Ext.WindowManager.getActive();) Busque la solución editada. Ciao! – Wilk

Cuestiones relacionadas