1. #1
    Ext JS Premium Member Artistan's Avatar
    Join Date
    Apr 2007
    Location
    MN
    Posts
    144
    Vote Rating
    0
    Artistan is on a distinguished road

      0  

    Default Stores and Models

    Stores and Models


    I have noticed a few things dealing with stores and models.

    1. JSON Stores default to AjaxProxy, acceptable.
    - when you transform the AjaxProxy to a RestProxy, the name stays with MyAjaxProxy1...
    - this can be very confusing when working on the stores.
    - maybe simply allowing to manually set the "name" of the Proxy, or auto change it based on the type?

    2. Defining a store with a model.
    - correct me if I am wrong, but can you not define a model with a proxy and then use that model to create multiple stores?
    - below is what designer makes.
    - below that is what I suggest. (using the Model's Proxy if the store proxy is deleted.)
    - this would require allowing to delete proxy/reader from store?

    Model.
    Code:
    Ext.define('BenAdmin.model.VisitsSites', {
        extend: 'Ext.data.Model',
    
        idProperty: 'vsid',
        remoteFilter: true,
        remoteSort: true,
    
        proxy: {
            type: 'rest',
            url: 'http://visits.benint.net/rest/siteshare/visits/site/',
            reader: {
                type: 'json',
                idProperty: 'vsid',
                root: 'items',
                totalProperty: 'totalCount'
            }
        },
        fields: [
            {
                name: 'vsid',
                type: 'int'
            },
            {
                name: 'sitename',
                type: 'string'
            },
            {
                name: 'db',
                type: 'string'
            }
        ]
    });
    Store.
    Code:
    Ext.define('BenAdmin.store.VisitsSites', {
        extend: 'BenAdmin.store.base.VisitsSites',
        alias: 'widget.store_visits_sites',
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({}, cfg)]);
        }
    
    });
    Base Store.
    Code:
    Ext.define('BenAdmin.store.base.VisitsSites', {
        extend: 'Ext.data.Store',
        requires: [
            'BenAdmin.model.VisitsSites'
        ],
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                autoLoad: true,
                autoSync: true,
                storeId: 'store_visits_sites',
                model: 'BenAdmin.model.VisitsSites',
                remoteFilter: true,
                remoteSort: true,
                proxy: {
                    type: 'ajax',
                    url: 'http://visits.benint.net/rest/siteshare/visits/site/',
                    reader: {
                        type: 'json',
                        idProperty: 'vsid',
                        root: 'items',
                        totalProperty: 'totalCount'
                    }
                }
            }, cfg)]);
        }
    });
    ALTERNATE BASE STORE
    Should use the Model's Proxy????
    ( Currently cannot delete a proxy/reader from a designer store )
    Code:
    Ext.define('BenAdmin.store.base.VisitsSites', {
        extend: 'Ext.data.Store',
        requires: [
            'BenAdmin.model.VisitsSites'
        ],
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                autoLoad: true,
                autoSync: true,
                storeId: 'store_visits_sites',
                model: 'BenAdmin.model.VisitsSites',
                remoteFilter: true,
                remoteSort: true
            }, cfg)]);
        }
    });
    FROM THE Model Docs...


    Usage in Stores

    It is very common to want to load a set of Model instances to be displayed and manipulated in the UI. We do this by creating aStore:
    var store =Ext.create('Ext.data.Store',{ model:'User'});//uses the Proxy we set up on Model to load the Store data store.load();A Store is just a collection of Model instances - usually loaded from a server somewhere. Store can also maintain a set of added, updated and removed Model instances to be synchronized with the server via the Proxy. See the Store docs for more information on Stores.

  2. #2
    Sencha - Architect Dev Team Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD
    Posts
    1,729
    Vote Rating
    51
    Phil.Strong is a jewel in the rough Phil.Strong is a jewel in the rough Phil.Strong is a jewel in the rough Phil.Strong is a jewel in the rough

      0  

    Default


    1. Agreed. needs to be addressed

    2. You can delete it from menu or using shortcut but the context menu incorrectly reports you cannot
    Phil Strong
    @philstrong
    #SenchaArchitect
    Sencha Architect Development Team

  3. #3
    Ext JS Premium Member Artistan's Avatar
    Join Date
    Apr 2007
    Location
    MN
    Posts
    144
    Vote Rating
    0
    Artistan is on a distinguished road

      0  

    Exclamation


    OK, so I deleted the proxy/reader from the store via the menu as you suggested would work.
    Now I am getting all kinds of errors!
    What do you suggest here?

    idProperty is deprecated as a property directly on the Model prototype. Please put it inside the config object.
    sencha-touch-all-debug.js:32993fields is deprecated as a property directly on the Model prototype. Please put it inside the config object.
    sencha-touch-all-debug.js:32993proxy is deprecated as a property directly on the Model prototype. Please put it inside the config object.

  4. #4
    Sencha - Architect Dev Team Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD
    Posts
    1,729
    Vote Rating
    51
    Phil.Strong is a jewel in the rough Phil.Strong is a jewel in the rough Phil.Strong is a jewel in the rough Phil.Strong is a jewel in the rough

      0  

    Default


    In a build coming soon this will be possible and a overall better experience.
    Phil Strong
    @philstrong
    #SenchaArchitect
    Sencha Architect Development Team

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar