Friday, September 9, 2011

ExtJS (2.2.1): Ext.Button absolute position

A Button is not an Ext.BoxComponent, so it cannot be positioned using x and y properties. So the problem can be solved by adding the button to a transparent panel with the same size as the button.


var MyPanel = new Ext.Panel({
            layout:'absolute',
            width:400,
            height:200,
            items:[{
                xtype:'textfield',
                width:150,
                x:0,
                y:0
            },{
                xtype:'combo',
                width:150,
                x:160,
                y:0
            },{
                xtype:'panel',
                y:25,
                x:0,
                items:[
                {
                    xtype:'button',
                    text:'Search'
                }]
            }]
});

Source:
http://www.sencha.com/forum/showthread.php?37012-Ext.Button-absolute-position-help

No comments: