A collection of Sencha ExtJS and Touch 'Store' examples

Here is a small collection of Sencha ExtJS ‘Store’ objects from a recent project. I suspect they will also work with Sencha Touch, though I haven’t tried them there yet. (They may need a few small modifications, dunno.) I share them here hoping they will help anyone who needs to see some =Store= examples.

First, this Store object is named Users:

Ext.define('Focus.store.Users', {
    extend: 'Ext.data.Store',

    requires: [
        'Focus.model.User'
    ],

    model: 'Focus.model.User',

    proxy: {
        type: 'ajax',
        url: 'php/security/users.php',
        
        reader: {
            type: 'json',
            root: 'data'
        }
    }
});

This one is named Projects:

Ext.define('Focus.store.Projects', {
    extend: 'Ext.data.Store',
    requires: 'Focus.model.Project',
    model: 'Focus.model.Project',

    proxy: {
        type: 'ajax',
        url: '/server/projects',
        method: 'GET',
        noCache: false,
        reader: {
            type: 'json'
        }
    }

});

And this big daddy is named Tasks:

Ext.define('Focus.store.Tasks', {
    extend: 'Ext.data.Store',
    model: 'Focus.model.Task',

    requires: [
        'Focus.model.Task',
        'VP.util.Utils'
    ],

    proxy: {
        type: 'ajax',
        url: '/server/tasks',
        //url: 'data/tasks.json',

        // some vars to help control the url
        noCache: false,
        limitParam: false,
        enablePagingParams: false,
        startParam: false,

        // TODO I REALLY WANT 'POST' HERE
        // because i want 'read' to be a POST
        // actionMethods: {
        // create : 'POST',
        // read : 'GET', // defaults to GET
        // update : 'POST',
        // destroy: 'POST'
        // },
        reader: {
            type: 'json',
            idProperty: 'id',
            successProperty: 'success',
            root: 'tasks'
        },

        afterRequest: function(req, res) {
            // console.log("In Tasks Proxy, Operation Response: ");
            // VP.util.Utils.dumpObject(req.operation.response);
        },
        listeners : {
            exception : function(proxy, response, operation) {
                if (operation) {
                    console.log('IN "IF OPERATION" BRANCH');
                } else {
                    // May be a proxy error...
                    console.log('MAY BE A PROXY ERROR');
                }
            }
        }
        // extraParams:{ // so i can pass in the projectId
        // //format: 'json'
        // }
    },

    // 'autoLoad' is evil
    // autoLoad: true,

});

Here are a few URLs related to Sencha stores: