I created a formpanel, which has a predefined width and height:
var myCrearUsuarioFormPanel = Ext.create('WebMonitorClass.view.CrearUsuarioFormPanel');
Know I needed to put my myCrearUsuarioFormPanel into a window. I needed to set the window width and height the same as the myCrearUsuarioFormPanel width and height:
var myWindow = Ext.create("Ext.Window",{
width : myCrearUsuarioFormPanel.getWidth() // here I tried that
,height: myCrearUsuarioFormPanel.getHeight() // here I tried that
,title : 'Crear Usuario'
,layout: 'absolute'
,closable : false
,items:[myCrearUsuarioFormPanel]
}).show();
But I Got:
Uncaught TypeError: Cannot call method 'getWidth' of undefined
in this line
width : myCrearUsuarioFormPanel.getWidth()
The solution is to use the offsetWidth and offsetHeight properties:
var myWindow = Ext.create("Ext.Window",{
width : myCrearUsuarioFormPanel.offsetWidth // Here is the solution
,height: myCrearUsuarioFormPanel.offsetHeight // Here is the solution
,title : 'Crear Usuario'
,layout: 'absolute'
,closable : false
,items:[myCrearUsuarioFormPanel]
}).show();
Resource:
http://stackoverflow.com/questions/5249723/wrong-div-width-when-getting-it-with-javascript
http://stackoverflow.com/questions/10634282/in-extjs-when-dragdrop-offsetwidth-is-null-or-not-an-object-error-for-ie7
No comments:
Post a Comment