O'Reilly logo

PhoneGap By Example by Andrey Kovalenko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying the list of photos

The last thing we can do is to populate the view with all the captured images.

Let's create the controller in the app/controller/Pictures.js file:

Ext.define('Imaginary.controller.Pictures', {
    extend: 'Ext.app.Controller',
    config: {
        refs: {
            photoContainer: '#photos'
        }
    },
    launch: function() {
        var pictures = this.getPictures();
        var photoContainer = this.getPhotoContainer();
        for (var i = 0; i < pictures.length; i++) {
            this.addPictureToContainer(pictures[i], photoContainer);
        }
    }
    // getPictures and addPictureToContainer implementation goes here
});

The main purpose of the controller is to retrieve all pictures from the pictures store, create images, and add them to the container, as presented here in the addPictureToContainer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required