View Full Version : Create items for carousel dynamically

28 Apr 2011, 10:31 AM
Hello. I am an absolute noob to Sencha Touch. I have been building a proof-of-concept app now for 2 weeks. Learning through tutorials and internet searchs. This is a very simple app and I'm almost embarrassed to ask (almost!). But I have wasted too much time on this.

Has anyone an example of how best to create the items for a carousel dynamically? Here's the example. It's an MVC architected app. There is a carousel panel created when an item in a List panel is tapped. Each list item represents an image gallery containing nth number of images. The List Panel is generated from a json store loaded from the server. The json file contains the Title of the set of images to be displayed, the name of the directory on the server where the images are located, and the number of images in the directory. The carousel is used to display the images for that listed image gallery.

Now there are a few ways to declare the items that go into a carousel. But regardless, at some point there has to be a pointer to an image, in a directory, on the server. But one list item's directory might contain 5 images, while another list item's directory might contain 10 images. Others might contain up to 50 images.

So what's the best way (or even a good way) to iterate over the image count in the json file to dynamically build the item list for the carousel to use? Or, am I just thinking incorrectly and should be looking at this differently?

Thanks in advance.