PDA

View Full Version : Width in % . Anchor problem



Nexus3
24 Feb 2011, 4:24 AM
Hi, first sorry because my english is no long.

Im trying to insert two panels in a window in horizontal (i do this floating the panels), and i want give to this panels width in %. I try to use anchor property, but dont works...... If i put the width in pixels yes work, but i need put the width in percentage

The code

Ext.ns('com.quizzpot.tutorial');

//the blank image
Ext.BLANK_IMAGE_URL = '../ext-2.2/resources/images/default/s.gif';

com.quizzpot.tutorial.Window = {

init: function(){

var panel2 = new Ext.Panel({
title: 'Reports',
iconCls: 'reports',
anchor:25,
style: { // when you add custom margin in IE 6...
"float":"left",
},
});
var panel3 = new Ext.Panel({
title: 'Documents',
iconCls: 'documents',
anchor:75,
style: { // when you add custom margin in IE 6...
"float":"left",
},
});

var win = new Ext.Window({
title: 'Quizzpot.com',
maximized:true,
minimizable: true,
maximizable: true,
items: [
panel2,panel3
]



});



win.show();
}
}

Ext.onReady(com.quizzpot.tutorial.Window.init,com.quizzpot.tutorial.Window);


Tanks

Condor
24 Feb 2011, 6:37 AM
Use layout:'column' with a 'columnWidth' for each panel.

(on newer Ext versions I would recommend using layout:'hbox' with 'flex')

Nexus3
24 Feb 2011, 7:02 AM
Thank you very much Condor, i do the second option (layout:'hbox' with 'flex') and now works perfect !!!!!!!
Thanks again