View Full Version : iterating through carousel items

20 Jul 2011, 10:54 AM
I have a carousel with 3 items.

However, I cannot access them with carousel.item[x]. I want to apply a CSS transform to each card (rotate 90 degrees) on orientation change.

How can I access the items array?

right now I have

parent panel has:

and this function is what is called:

carousel1.turnimages=(function() {
var layout=Ext.Viewport.getOrientation();

if (layout=='portrait' || 1)

clearly nothing is really happening because I haven't figured out how to access each item.

20 Jul 2011, 11:01 PM
the 'items' is not an array (although you can initiailse it with an array) it's actually of type Ext.util.MixedCollection.

you need to call

which will return the item by key or index to get the specific item you want...

you can probably do


21 Jul 2011, 5:21 AM
thank you so much!

is there a place in the API doc where it discusses this? How did you discover this? I often struggle figuring out what things 'are' and by extension what their methods and properties truly are.

21 Jul 2011, 5:29 AM
in the sencha download there a nice /docs/index.html guide where you can search, filter, drill down etc...

21 Jul 2011, 5:38 AM
right, but nowhere in there (I was looking at carousel.items) does it say that the items is a Ext.util.MixedCollection.

I had gone through that and all it says is that you hand items an array of Ext components (thus why I thought it was an array). I'm just wondering how you found out what the type was? The docs seem very incomplete.

In fact... I don't see anything about Ext.util.MixedCollection at all!!

21 Jul 2011, 5:57 AM
what version are you using?
i'm on 1.1.0

if i lookup Carousel and go down to 'Public Properties' i see the items is a MixedCollection.

granted, it is confusing as when you init the object you pass an array and it converts that to a MixedCollection under the hood.

It's not that clear i guess...

i find generally the docs are alright - esp when compared to open source libs ;-)

21 Jul 2011, 6:13 AM
I'm using the online doc and it says "object/array".

are they not updating the online docs to the newest version?

21 Jul 2011, 6:18 AM
docs look the same to me - but that is part of the config options rather than a method / property of the object...
it is converted under the hood when the object is init...
it's not really that obvious though...

21 Jul 2011, 6:28 AM
Ahh., I see where you are looking.

Yeah I'm not really familiar with the layout of the doc yet. Thanks for pointing that out. Now, where can I find the details on what mixedCollection has lol. It isn't under the list of components in the big tree on the left (or I missed this as well).