Uno de los objetos más útiles y utilizados para las aplicaciones en ExtJs, es el objeto Window el anfitrión de esta vez, crearemos y explicaremos en el siguiente video las propiedades, métodos y eventos más utilizados sobre este objeto, creando una ventana desde cero y apoyándonos con la bien dotada API de ExtJs.
Nota: por problemas de conectividad no se a publicado el video, pero aqui les paso el codigo de como crear un objeto windows.
Codigo utilizado:
var btnAbrir = new Ext.Panel({
border: false,
y: 20,
x: 30,
items:{
xtype: 'button',
text: 'Abrir Ventana',
handler: function(){
miventana.show();
}
}
})
Ext.onReady(function(){
new Ext.Panel({
title: 'Mi Panel',
renderTo: document.body,
width: 200,
height: 100,
frame: true,
layout: 'absolute',
items: [ btnAbrir ]
})
})
//Ext.MessageBox.alert('Alerta','Hola Mundo');
// Objeto windows
var miventana = new Ext.Window({
renderTo: document.body,
title: 'Mi ventana',
width: 600,
height: 400,
maximizable: true,
modal: true,
closeAction: 'hide',
//resizable: false,
minWidth: 500,
minHeight: 350,
maximized: false,
constrain: true
})
Atributos utilizados en objeto windows:
renderTo: variado (Mixed)
El id del nodo, el nodo del DOM, o un Elemento existente el cual pueda ser contenedor para renderear este componente. Usando esta configuracion no es necesario llamar el metodo render().
The id of the node, a DOM node or an existing Element that will be the container to render this component into. Using this config, a call to render() is not required.
title: Cadena
El titulo es la descripcion desplegada en la cabecera de la ventana, ( valor por defecto ''). Cuando se especifica el titulo la cabecera del elemento es creado y mostrado automaticamente a menos que el atributo header se ponga como false, si no queremos especificar el titulo al momento de la configuracin del objeto, pero lo queremos hacer despues, podemos tambien si no queremos especificar un titulo (dejamos un espacio en blanco ' ') o fijar el atributo header : true para elemento contendor pueda crearlo
The title text to display in the panel header (defaults to ''). When a title is specified the header element will automatically be created and displayed unless header is explicitly set to false. If you don't want to specify a title at config time, but you may want one later, you must either specify a non-empty title (a blank space ' ' will do) or header:true so that the container element will get created.
width: Numerico
El ancho en pixeles de este componente (por defecto auto)
The width of this component in pixels (defaults to auto).
height: Numerico
El alto en pixeles de este componente (por defecto auto)
The height of this component in pixels (defaults to auto).
maximizable: Boleano
True para mostrarel boton de 'maximizar' y permitir que el usuario maximize la ventana, false para ocultar el boton y no permitir que se maximize la ventana (por defecto false). Nota cuando la ventana es maximizada, el boton cambiara automaticamente a un boton de 'restauracion' con el comportamiento apropiado ya programado que permite resgresar la ventana a su tamaño previo.
True to display the 'maximize' tool button and allow the user to maximize the window, false to hide the button and disallow maximizing the window (defaults to false). Note that when a window is maximized, the tool button will automatically change to a 'restore' button with the appropriate behavior already built-in that will restore the window to its previous size.
modal: Boleano
True para hacer la ventana modal y crear una mascara detras cuando esta se muestre, false para mostarla sin ninguna restricion de acceso hacia los otros elementos del UI (por defecto false)
True to make the window modal and mask everything behind it when displayed, false to display it without restricting access to other UI elements (defaults to false).
closeAction: Cadena
La accion que se toma cuando se le da click al boton cerrar. El accion por defecto es 'close' la cual automaticamente remueve el objeto window del DOM y lo destruye. La opcion valida es 'hide' la cual simplemente oculta la ventana por medio de la configuracionvisibility a hidden y aplica un offsets negativo,
manteniendo la vetana disponible para volver a ser mostrada bajo el metodo show.
The action to take when the close button is clicked. The default action is 'close' which will actually remove the window from the DOM and destroy it. The other valid option is 'hide' which will simply hide the window by setting visibility to hidden and applying negative offsets, keeping the window available to be redisplayed via the show method.
minHeight : Number
La altura minima permitida en pixeles para la ventana (por defecto a 100). Solamente se aplica cuando resizable = true
The minimum height in pixels allowed for this window (defaults to 100). Only applies when resizable = true.
minHeight : Number
El ancho minimo permitido en pixeles para la ventana (por defecto a 200). Solamente se aplica cuando resizable = true
minHeight : Number
El ancho minimo permitido en pixeles para la ventana (por defecto a 200). Solamente se aplica cuando resizable = true
The minimum height in pixels allowed for this window (defaults to 100). Only applies when resizable = true.
maximized : Boleano
True para mostrar la ventana en un estado maximizado. (por defecto false)
True to initially display the window in a maximized state. (Defaults to false).
constrain : Boleano
True para obligar a la ventana esta a la vista, false para permitir que esta quede fuera de la vista (por defecto en false). otra opcion es que solo la cabecera este obligada usando el atributo constrainHeader.
True to constrain the window to the viewport, false to allow it to fall outside of the viewport (defaults to false). Optionally the header only can be constrained using constrainHeader.
tambien les dejo el enlace para que revisen todas las propiedades del objeto window y todos los demas http://www.extjs.com/deploy/dev/docs/
maximized : Boleano
True para mostrar la ventana en un estado maximizado. (por defecto false)
True to initially display the window in a maximized state. (Defaults to false).
constrain : Boleano
True para obligar a la ventana esta a la vista, false para permitir que esta quede fuera de la vista (por defecto en false). otra opcion es que solo la cabecera este obligada usando el atributo constrainHeader.
True to constrain the window to the viewport, false to allow it to fall outside of the viewport (defaults to false). Optionally the header only can be constrained using constrainHeader.
tambien les dejo el enlace para que revisen todas las propiedades del objeto window y todos los demas http://www.extjs.com/deploy/dev/docs/
Hola saben como hacer para quitar el boton de cerrar en un window
ResponderEliminaragrega una opcion que es
ResponderEliminarclosable:false
Hola tengo un problema..tengo dos Ventanas en una forma y este layout es acordion y abro una y la cierro y al momento de abrir la otra los elementos de la otra ventana estan duplicados, me recomendaron que usara el ActionClose 'hide' pero no soluciona mi error, soluciona mi error si fuera una ventana pero son dos...que puedo hacer? .
ResponderEliminarcomo sustituir los botones de cerrar minimizar y maximizar en cualquier ventana
ResponderEliminarcomo puedo agregarle un btn al nuevo windows
ResponderEliminar