PDA

View Full Version : How to use "setActiveItem" on carousel in carousel



doggroup
8 Mar 2011, 7:59 PM
sink.Structure = [ {
text: 'Forside',
leaf: true,
id:'wo-page-0',
xtype: 'carousel',
direction: 'vertical',
items: [ {
text: 'Forside',
card:'card-43',
html: '<div><div class="ingress"></div></div>',
} ]
}, {
text: 'Hva vi gjør',
leaf: true,
id:'wo-page-1',
xtype: 'carousel',
direction: 'vertical',
items: [ {
text: 'Hva vi gjør',
card:'card-257',
html: '<h2>Hva vi gjør</h2>',
} ,{
card:'card-183',
text: 'Publisering',
html: '<h2>Publisering</h2><div class="content-info"><div class="ingress"></div></div>',
} ,{
card:'card-186',
text: 'E-handel ',
html: '<h2>E-handel </h2><div class="content-info"><div class="ingress"></div></div>',
} ,{
card:'card-262',
text: 'Design',
html: '<h2>Design</h2><div class="content-info"><div class="ingress"></div></div>',
} ]
}, {
text: 'Kunder',
leaf: true,
id:'wo-page-2',
xtype: 'carousel',
direction: 'vertical',
items: [ {
text: 'Kunder',
card:'card-296',
html: '<h2>Kunder</h2><div class="content-info"><div class="ingress"></div></div>',
} ]
}, {
text: 'Aktuelt',
leaf: true,
id:'wo-page-3',
xtype: 'carousel',
direction: 'vertical',
items: [ {
text: 'Aktuelt',
card:'card-297',
html: '<h2>Aktuelt</h2>',
} ,{
card:'card-84',
text: 'SYNSAM',
html: '<h2>SYNSAM</h2><div class="content-info"><div class="ingress"></div></div>',
} ,{
card:'card-98',
text: 'ENKLERE LIV',
html: '<h2>ENKLERE LIV</h2><div class="content-info"><div class="ingress"></div></div>',
} ,{
card:'card-102',
text: 'ISHAVSKRAFT',
html: '<h2>ISHAVSKRAFT</h2><div class="content-info"><div class="ingress"></div></div>',
} ]
} ];
this.carousel = new Ext.Carousel({
defaults: {
cls: 'card',
cardSwitchAnimation: 'slide',
},
id:'wo-page',
items: sink.Structure,
});


it works fine when I use "Ext.getCmp('wo-page').setActiveItem(1, 'slide')"

but It don't work on carousel in carousel when I use "Ext.getCmp('wo-page-3').setActiveItem(2, 'slide');"

I would like to show content from 'card-84' under 'wo-page-3'.
Can you help me? :-?

vishalnnsingh
8 Mar 2011, 8:27 PM
text: 'Aktuelt',
leaf: true,
id: 'wo-page-3',
xtype: 'carousel',
//Add this in your code
layout:'card', // Not sure but it may work

direction: 'vertical',
items: [{
text: 'Aktuelt',
card: 'card-297',
html: '<h2>Aktuelt</h2>',
}, {
card: 'card-84',
text: 'SYNSAM',
html: '<h2>SYNSAM</h2><div class="content-info"><div class="ingress"></div></div>',
}, {
card: 'card-98',
text: 'ENKLERE LIV',
html: '<h2>ENKLERE LIV</h2><div class="content-info"><div class="ingress"></div></div>',
}, {
card: 'card-102',
text: 'ISHAVSKRAFT',
html: '<h2>ISHAVSKRAFT</h2><div class="content-info"><div class="ingress"></div></div>',
}]
}

doggroup
8 Mar 2011, 10:43 PM
it works, Thanks =P~