Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Jan 2011
    Posts
    9
    Vote Rating
    0
    adisharoon is on a distinguished road

      0  

    Default Unanswered: HasManyAssociation automatic store-creating function not present?

    Unanswered: HasManyAssociation automatic store-creating function not present?


    I have an MVC application with two models. One (client) has many of the other (environments). The actual data is returned by JSON that looks like this:

    Code:
    {"environmentsByClient": [{"client": "ONE", "environments": [{"window": "12:00", "type": "MM", "name": "ONE-MM"}, {"window": "1:00", "type": "NN", "name": "ONE-NN"}]},{"client": "TWO", "environments": [{"window": "12:00", "type": "MM", "name": "TWO-MM"}, {"window": "1:00", "type": "NN", "name": "TWO-NN"}]}]}
    The other code is (these are actually separate files that are referenced in the applications 'models' config option):

    Code:
    Ext.define("sqlDeploy.model.clientModel", {
            extend: "Ext.data.Model",
            fields: [
                {
                    name: "client",
                    type: "string"
                },
            ],
            proxy: {
                type: "ajax",
                url: "getEnvironments",
                reader: {
                    type: "json",
                    root: "environmentsByClient"
                },
                pageParam: undefined,
                startParam: undefined,
                limitParam: undefined
            },
            hasMany: {
                model: "environmentModel",
                name: "environments"
            }
        }
    );
    
    Ext.define("sqlDeploy.model.environmentModel", {
            extend: "Ext.data.Model",
            fields: [
                {
                    name: "name",
                    type: "string"
                },
                {
                    name: "type",
                    type: "string",
                },
                {
                    name: "window",
                    type: "time"
                }
            ],
            belongsTo: {
                model: "clientModel",
                name: "client"
            }
        }
    )
    My question, then, is why doesn't something like this work:

    Code:
    var store = Ext.create("Ext.data.Store", {
        model: "sqlDeploy.model.clientModel"
    });
    
    
    store.load({
        callback: function(){
            console.log(store.first().environments());
        }
    });
    I get "store.first().environments is not a function".

    That last bit is a simplification - I'm actually using these in a couple of dependent combo boxes.

    Alec

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    9
    Vote Rating
    0
    adisharoon is on a distinguished road

      0  

    Default Answering my own question

    Answering my own question


    Using the full name of the other model class, like this:

    hasMany: {
    model: "sqlDeploy.model.environmentModel",
    name: "environments"
    }

    in addition to noticing that the "select" event on ComboBox returns an array of records, instead of just the selected record. solved the problem
    Last edited by adisharoon; 4 Nov 2011 at 2:14 PM. Reason: final answer

Tags for this Thread