PDA

View Full Version : Help with a dynamically generated carousel



iodic
6 Dec 2010, 10:41 AM
Hello Sencha World,

This is my first post and I realize that my problem might seem trivial but I am a total Sencha newbie (coming from jQuery, this is a totally different approach) so... please help. :">

I am building a web app for the iPad and, among other things, it will contain galleries that are populated with images whose URLs and dimensions are stored within XML files. Now, I tried to modify the carousel2 example that comes with the Sencha Touch package (version 1.0.1) but I have a couple of problems that I was hoping someone could help me solve.

This is a sample structure of the XML files:


<?xml version="1.0" encoding="utf-8"?>
<Gallery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="wedding" Name="wedding">
<Images>
<ImageGalleryEntry Name="wedding01.jpg" FileName="331500.wedding01.jpg" Width="876" Height="640">
<S3Key>[...]</S3Key>
<S3ThumbnailKey>[...]</S3ThumbnailKey>
<ContentLength>[...]</ContentLength>
</ImageGalleryEntry>
<ImageGalleryEntry Name="wedding02.jpg" FileName="479964.wedding02.jpg" Width="640" Height="876">
[...]
</ImageGalleryEntry>
[...]
<Images>
</Gallery>

(I have truncated the S3Key, S3ThumbnailKey & ContentLength values because they are irrelevant for the application.)

My first question is: how do I get the values of the attributes in the ImageGalleryEntry keys, namely: FileName, Width & Height? I want to output IMG tags and use those values for the attributes of the IMG tags.

My second question relates to an error I keep getting:
TypeError: Result of expression 'root.querySelectorAll' [undefined] is not a function. I get the error with the slightly modified carousel2 example. I have tried to get the S3ThumbnailKey value (just to test the app) and this is the only other change that I have made (apart from changing the path of the XML file and the model):


reader: {
type: 'xml',
root: 'Images',
record: 'ImageGalleryEntry'
}

Again, I would really appreciate your help and I can post the complete index.js file if necessary.

Thanks! :)