1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    25
    Vote Rating
    0
    sveatlo is on a distinguished road

      0  

    Default Answered: record.get('string') returns undefined

    Answered: record.get('string') returns undefined


    Hi,
    I've got a following treestore:
    Code:
    Ext.define('Statistics.store.Menu', {
        extend: 'Ext.data.TreeStore',
        model: 'Menu',
        storeId: 'MenuStore',
        autoLoad: true,
        autoSync: true,
        
        proxy   : {
            type : 'ajax',
            url  : 'resources/scripts/get_menu.php?callback=1',
            reader: {
                type: 'json',
                successProperty: 'success'
            }
        }
        
        
    });
    The get_menu.php script returns following JSON-formatted reply:

    Code:
    {"success": true,"children": [{"text": "Home","leaf": true},{
                    "text"     : "Moje Firma s.r.o.",
                    "dbName"   : "demo",
                    "leaf"       : false,
                    "expanded" : false,
                    "children" : [
                        {
                            "text" : "Vydane",
                            "leaf" : true
                        },
                        {
                            "text" : "Prijate",
                            "leaf" : true
                        }
                    ]
                },{
                    "text"     : "Já Živnostník",
                    "dbName"   : "demo_de",
                    "leaf"       : false,
                    "expanded" : false,
                    "children" : [
                        {
                            "text" : "Vydane",
                            "leaf" : true
                        },
                        {
                            "text" : "Prijate",
                            "leaf" : true
                        }
                    ]
                },{
                    "text"     : "Nezisková organizace",
                    "dbName"   : "demo_neziskova",
                    "leaf"       : false,
                    "expanded" : false,
                    "children" : [
                        {
                            "text" : "Vydane",
                            "leaf" : true
                        },
                        {
                            "text" : "Prijate",
                            "leaf" : true
                        }
                    ]
                },{
                    "text"     : "Příspěvková organizace",
                    "dbName"   : "demo_prispevkovka",
                    "leaf"       : false,
                    "expanded" : false,
                    "children" : [
                        {
                            "text" : "Vydane",
                            "leaf" : true
                        },
                        {
                            "text" : "Prijate",
                            "leaf" : true
                        }
                    ]
                },{
                    "text"     : "Moje Firma SK s.r.o.",
                    "dbName"   : "demo_sk",
                    "leaf"       : false,
                    "expanded" : false,
                    "children" : [
                        {
                            "text" : "Vydane",
                            "leaf" : true
                        },
                        {
                            "text" : "Prijate",
                            "leaf" : true
                        }
                    ]
                }]}
    When I try to get the text field, everything works fine, but when I try to get the dbName field, it returns undefined.
    Code:
    record.get('text')            //returns the real value
    record.get('dbName')         //returns undefined
    Can somebody help me, please?

    Thanks for any answer

  2. Code:
    Ext.define('Statistics.store.Menu', {
        extend: 'Ext.data.TreeStore',
        model: 'Menu',
    Code:
    Ext.define('Statistics.model.Menu', {
    Your model names don't match.

  3. #2
    Sencha User Fire-Dragon-DoL's Avatar
    Join Date
    Dec 2011
    Posts
    140
    Answers
    9
    Vote Rating
    1
    Fire-Dragon-DoL is on a distinguished road

      0  

    Default


    Quote Originally Posted by sveatlo View Post
    Hi,
    I've got a following treestore:
    Code:
    Ext.define('Statistics.store.Menu', {
        extend: 'Ext.data.TreeStore',
        model: 'Menu',
        storeId: 'MenuStore',
        autoLoad: true,
        autoSync: true,
        
        proxy   : {
            type : 'ajax',
            url  : 'resources/scripts/get_menu.php?callback=1',
            reader: {
                type: 'json',
                successProperty: 'success'
            }
        }
        
        
    });
    The get_menu.php script returns following JSON-formatted reply:

    Code:
    {"success": true,"children": [{"text": "Home","leaf": true},{
                    "text"     : "Moje Firma s.r.o.",
                    "dbName"   : "demo",
                    "leaf"       : false,
                    "expanded" : false,
                    "children" : [
                        {
                            "text" : "Vydane",
                            "leaf" : true
                        },
                        {
                            "text" : "Prijate",
                            "leaf" : true
                        }
                    ]
                },{
                    "text"     : "Já Živnostník",
                    "dbName"   : "demo_de",
                    "leaf"       : false,
                    "expanded" : false,
                    "children" : [
                        {
                            "text" : "Vydane",
                            "leaf" : true
                        },
                        {
                            "text" : "Prijate",
                            "leaf" : true
                        }
                    ]
                },{
                    "text"     : "Nezisková organizace",
                    "dbName"   : "demo_neziskova",
                    "leaf"       : false,
                    "expanded" : false,
                    "children" : [
                        {
                            "text" : "Vydane",
                            "leaf" : true
                        },
                        {
                            "text" : "Prijate",
                            "leaf" : true
                        }
                    ]
                },{
                    "text"     : "Příspěvková organizace",
                    "dbName"   : "demo_prispevkovka",
                    "leaf"       : false,
                    "expanded" : false,
                    "children" : [
                        {
                            "text" : "Vydane",
                            "leaf" : true
                        },
                        {
                            "text" : "Prijate",
                            "leaf" : true
                        }
                    ]
                },{
                    "text"     : "Moje Firma SK s.r.o.",
                    "dbName"   : "demo_sk",
                    "leaf"       : false,
                    "expanded" : false,
                    "children" : [
                        {
                            "text" : "Vydane",
                            "leaf" : true
                        },
                        {
                            "text" : "Prijate",
                            "leaf" : true
                        }
                    ]
                }]}
    When I try to get the text field, everything works fine, but when I try to get the dbName field, it returns undefined.
    Code:
    record.get('text')            //returns the real value
    record.get('dbName')         //returns undefined
    Can somebody help me, please?

    Thanks for any answer
    Model definition? We need it to check if you didn't forget to update fields there.

  4. #3
    Sencha User
    Join Date
    Sep 2012
    Posts
    25
    Vote Rating
    0
    sveatlo is on a distinguished road

      0  

    Default


    Model:
    Code:
    Ext.define('Statistics.model.Menu', {
        extend: 'Ext.data.Model',
        
        fields: [
            {name: 'text', type: 'string'},
            {name: 'dbName', type: 'string'},
            {name: 'leaf', type: 'boolean'},
            {name: 'expanded', type: 'boolean', defaultValue: false} 
        ],
    
    
    });

  5. #4
    Sencha User skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,338
    Answers
    498
    Vote Rating
    248
    skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of skirtle has much to be proud of

      0  

    Default


    Code:
    Ext.define('Statistics.store.Menu', {
        extend: 'Ext.data.TreeStore',
        model: 'Menu',
    Code:
    Ext.define('Statistics.model.Menu', {
    Your model names don't match.

Thread Participants: 2

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