PDA

View Full Version : Newbie Button Alignment



GregT
25 Sep 2009, 9:02 AM
Hi, first 2 hours of using EXT, be gentle ;) (If I'm in the wrong place for new people, please redirect me).

I want to add a Button (containing a GIF) to a Panel that is using Accordion. The image is left-aligned. I want it centered. Tried fiddling with buttonAlign and iconAlign, no luck. Any tips appreciated.

Condor
25 Sep 2009, 9:09 AM
What is your current button config?

GregT
25 Sep 2009, 9:12 AM
I think this is the relevant bit. As I said, the button/image DOES show up, just not the way I want it to. Maybe item1 IS centering its contents and the problem is that item1 is not centered inside Accordion and maybe Accordion should have an alignment property?

var item1 = new Ext.Panel({
title: 'Test',
buttonAlign: 'center', // i think this should work
width: 100,
cls:'empty'
});
item1.buttonAlign = 'center';
var wtf = new Ext.Button();
wtf.icon = 'icons/image2.gif';
wtf.iconAlign = 'center'; // i don't think this is relevant
item1.add(wtf);

var accordion = new Ext.Panel({
region:'west',
margins:'5 0 5 5',
split:true,
width: 500,
layout:'accordion',
items: [item1, item2, item3, item5]
});