PDA

View Full Version : [CLOSED][4.0.2] Ext.panel.Panel with layout card: bbar is null



vadimv
14 Jun 2011, 6:45 AM
Possible bug: bbar is null(see the comment in code), dockedItems is ok,
as example:


Ext.define('Appname.view.Card', {
extend: 'Ext.panel.Panel',
alias: 'widget.cardpanel',

requires: ['Ext.layout.container.Card'],

initComponent: function(){
var me = this;

Ext.apply(me, {
frame: false,
autoScroll : true,
layout:'card',
activeItem:0,
bbar: ['->', {
id: 'card-prev',
text: me.btnPrevText,
handler: Ext.Function.bind(me.cardNav, this, [-1]),
disabled: true
},{
id: 'card-next',
text: me.btnNextText,
handler: Ext.Function.bind(me.cardNav, this, [1])
,disabled: true
}],
items:[.....]
});

me.callParent(arguments);
},
cardNav:function(incr,index){
var me = this;
var l = me.getLayout();
if(incr!=undefined){
var i = l.activeItem.itemId.split('card-')[1];
index = parseInt(i, 10) + incr;
}

l.setActiveItem(index);
Ext.getCmp('card-prev').setDisabled(index===0);
Ext.getCmp('card-next').setDisabled(index===6);

// CHECK HERE : bbar is null
if(index==5){
var btn = me.dockedItems.items[0].getComponent('card-next'); // HERE IS OK.
.............
}
}
});


Shouldn't contain the "bbar" the items of "dockedItems" ?

evant
14 Jun 2011, 3:12 PM
No. The bbar is just there for convenience, you should access anything you need via the docked items.

vadimv
15 Jun 2011, 1:28 AM
I see... , thx Evant.