PDA

View Full Version : Right aligning a button in a tab bar



Sabareesh
23 Apr 2012, 11:35 PM
I have the following code for adding a button in tab bar , which has 3 tabs
listeners: {
afterrender: function () {
var bar = Ext.getCmp('artistTab').getTabBar();
bar.insert(4, {
xtype: 'button',
text: 'Add New Form',
id: 'formButton',
handler: function () {
// Some code
}
});
}
}

I want this button to be at the right corner of the tab bar , how can i do it .

Thanks

Ex_Soft
23 Apr 2012, 11:45 PM
tbfill (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.toolbar.Fill)?

Sabareesh
24 Apr 2012, 12:39 AM
Thanks .

I have alrady tried that but it is not working in tabbar , if it is toolbar it will work fine . But with tab bar i am not sure how to use .

If i add 'tbfill' i am getting an empty tab and next to that the button appears . I want the button to be at the right corner

one option is that i can use margins:'0 0 0 50' but i dont want to hardcode the values .

Any suggestions ?

Thanks.

Sabareesh
24 Apr 2012, 1:10 AM
I fixed that ,. I made two insert statements as below and it is working fine

listeners: {
afterrender: function () {
var bar = Ext.getCmp('artistTab').getTabBar();

bar.insert(3,{xtype: 'tbfill'});

bar.insert(4,{
xtype: 'button',
text: 'Add New Form',
id: 'formButton',
//margins : '0 0 0 745',
handler: function () {
//Some code
}
});
}
}

Thanks .