samedi 21 février 2015

How to right-align, v-center "buy" button in Ext.dataview.component.ListItem?

I am trying to create a buy button in a list view like the iTunes store on iOS.

IMG_0710.jpg


I am able to get the button in there but it is 100% height, has no right-margin, and the text isn't centered in it (see image below).


2015-02-21_13-25-42.jpg


Here is how I'm creating the ListItem:



Code:



Ext.define('Speakeasy.view.DeckItem', {
extend: 'Ext.dataview.component.ListItem',
alias: 'widget.deckitem',
config: {
layout: {
type: 'hbox'
},
hideAnimation: 'slideOut',
disabled: true,
items: [
{
xtype: 'component',
itemId: 'titleCmp',
__itemTpl: new Ext.XTemplate(
'<tpl for=".">',
'<tpl if="isPurchased">',
'<span class="deck-price">{price}</span>',
'</tpl>',
'</tpl>'
),
docked: 'left'
},
{
xtype: 'button',
text: 'Buy',
itemId: 'buy-button',
cls: 'buy-button',
hideAnimation: 'fadeOut',
showAnimation: 'slideIn',
docked: 'right',
handler: function(x, e) {
var sku = this.getParent().getRecord().get('sku');
decksController.Purchase(sku);
e.stopEvent();
}
}
]
},
});

Ext.define('Speakeasy.view.Decks', {
extend: 'Ext.List',
xtype: 'decks',
alias: 'widget.decksview',
requires: [
'Ext.TitleBar',
'Ext.data.Store'
],
config: {
itemId: 'decksview',
tabBarPosition: 'bottom',
layout: {
type: 'fit'
},
defaultType: 'deckitem',
// useComponents: true,
grouped: true,

Thanks you so much!



How to right-align, v-center "buy" button in Ext.dataview.component.ListItem?

Aucun commentaire:

Enregistrer un commentaire