PDA

View Full Version : TypeError: Result of expression 'this.layout.setActiveItem' [undefined] is not a func



pcr
2 Dec 2010, 1:50 AM
Hi in my app I want to switch between 2 cards. Until now I have created a card with a Dataview with thumbs. On tapping a thumbimage a second card is updated with the same picture. I can swipe to the second card. So far so good. I tried to make the switch to the second card done by the app by fmis.fb.setActiveItem(1) and in the second card fmis.fb.setActiveItem(0). fmis.fb is the Both give the error: TypeError: Result of expression 'this.layout.setActiveItem' [undefined] is not a function.
Here is the code I use:


fmis.fotolist = new Ext.DataView({
multiSelect: true,
layout: 'fit',
store: 'fbStore',
tpl: fmis.fotobeheerTpl,
autoHeight: true,
overItemCls: 'x-view-over',
itemSelector: 'div.thumb-wrap',
listeners: {
itemtap: function(view, index, item, e) {
var rec = view.store.getAt(index);
fmis.fb.setActiveItem(1);
fmis.fotodetail.update({
Regio: rec.get('Regio'),
Pand: rec.get('Pand')
});
}
},
emptyText: 'Geen fotos gevonden'
});

fmis.fotodetail = new Ext.Panel({
fullscreen: true,
tpl: fmis.fotobeheerFullscreenTpl,
dockedItems: [{
dock: 'top',
xtype: 'toolbar',
items: [{
text: 'Terug',
handler: function() {
fmis.fb.setActiveItem(0);
}
}]
}]
});

fmis.fb = new Ext.Panel({
cls: 'cards',
layout: {
type: 'vbox',
align: 'stretch'
},
defaults: {
flex: 1
},
items: [{
xtype: 'carousel',
items: [fmis.fotolist, fmis.fotodetail]
}]
});


BTW how do I use simple cards instead of cards in a carousel??
In a former thread I started I asked for help to show the selected thumb fullscreen. Thats what I really want.

tomalex0
2 Dec 2010, 3:46 AM
Are trying to set Card for Carousel Panel ?

fmis.fb.getComponent(0).setActiveItem(1)

if you are looking to set Card for fmis.fb
Then
You may have to specify it as card layout.
It contains only 1 item (carousel);
so setActiveItem(1) will not work probably

pcr
2 Dec 2010, 4:45 AM
Hi tomalex,

Muchos gracias. You are so great. This works. Now I gonna try to let the fotodetail card display fullscreen. Do you have a solution for that too??

tomalex0
2 Dec 2010, 5:17 AM
Could you try giving carousel panel "fullscreen:true". I'm not sure if it works.

There are some tutorials covering layout techniques. Have a look in to those.

tomalex0
2 Dec 2010, 5:19 AM
What you actually looking for

Some thing like this.
1.First Panel will be list of photos and when clicked
2.Show the Full size photo

pcr
2 Dec 2010, 5:51 AM
Yes, that's what I'm trying to do.

tomalex0
2 Dec 2010, 7:32 AM
new Ext.Panel({
layout:'card',
fullscreen:true,
items:[{
xtype:'panel', // for photolist
fullscreen:true,
items:[{
xtype:'dataview'
}]
},{
xtype:'panel', //photodetails
fullscreen:true,
}]
});


How about above structure ? Its just a basic structure that you require.