1. #1
    Sencha User
    Join Date
    Feb 2012
    Location
    Paris
    Posts
    98
    Answers
    2
    Vote Rating
    1
    Tchinkatchuk is on a distinguished road

      0  

    Default Answered: [ PR4 ] What's wrong with my store ?

    Answered: [ PR4 ] What's wrong with my store ?


    Hi all,

    I have tried many times and solutions for this but I've always encountered the same issue : "Uncaught TypeError: Object [object Object] has no method 'getRoot" while "Ext.define.updateStore" is executed in all-debug.js

    I have attached the zip wtih all files and I've copy paste all my code here. If someone has an idea or could test it, it will really be nice. I'm trying for hours now and gonna be mad

    index.html
    HTML Code:
    <!DOCTYPE html>
    <html>
        <head>
            <title>Getting Started</title>
            <link rel="stylesheet" href="../resources/css/sencha-touch.css" type="text/css">
            <script type="text/javascript" src="../sencha-touch-all-debug.js"></script>
            <script type="text/javascript" src="app.js"></script>
        </head>
        <body>
            <!-- hack so window opening works on all devices: http://www.sencha.com/forum/showthread.php?130358-window.open()-from-toolbar-button-opens-window-from-list-item-a-new-tab&p=639938#post639938 -->
            <a href="" target="_blank" id="linker" style="display:none;"></a>
        </body>
    </html>

    app.js
    Code:
    Ext.Loader.setConfig({ enabled: true });
    
    //Ext.Loader.setPath('Ext.data.proxy.Kiva', 'lib/KivaProxy.js');');
    //Ext.ClassManager.setAlias('Ext.data.proxy.Kiva', 'proxy.kiva');
    
    Ext.application({
        name        : 'Webshop',
        models      : ['Category'],
        views       : ['Main'],
        stores      : ['Categories'],
        controllers : ['Main'],
    
        launch: function() {
            Ext.create('Webshop.view.Main');
        }
    });

    app/controller/Main.js
    Code:
    // Ext.Webshop.Catalog controller
    Ext.define('Webshop.controller.Main', {
        extend: 'Ext.app.Controller',
    
        requires: [
            'Webshop.model.Category',
            'Webshop.store.Categories',
            'Webshop.view.Main'
        ],
    
        stores: ['Categories'],
    
        models: ['Category'],
    
        views: [
            'Main'
        ],
    
        init: function() {
            this.view = this.getMainView().create();
    
            this.categoriesStore = this.getCategoriesStore();
            this.categoriesStore.load({
                callback: this.onCategoriesLoad,
                scope: this
            });
    
            this.callParent(arguments);
        },
    
        onCategoriesLoad: function() {
            this.view.setStore(this.categoriesStore);
        }
    });

    app/view/Main.js
    Code:
    Ext.define('Webshop.view.Main', {
        extend: 'Ext.NestedList',
    
        config : {
            layout:'fit',
            fullscreen: true,
            displayField: 'text',
            store: null,
            title: 'Catalogue'
        }
    });

    app/store/Categories.js
    Code:
    Ext.define('Webshop.store.Categories', {
        extend: 'Ext.data.Store',
        requires: 'Webshop.model.Category',
        config: {
            model: 'Webshop.model.Category',
            autoLoad: false
        },
        root: {}
    });

    app/model/Category.js
    Code:
    Ext.define('Webshop.model.Category', {
        extend: 'Ext.data.Model',
        config: {
            fields: ['iItemId', 'text' ],
            proxy: {
                type: 'ajax',
                url: 'catalogcategory.json',
                reader: {
                    type: 'json',
                    rootProperty: 'items'
                }
            }
        }
    });

    catalogcategory.json
    Code:
    {
        "items": [
           {
               "iItemId": 1,
               "text": "Plomberie",
               "image": "plomberie-little.png",
               "items" : [
                    {
                        "iItemId": 11,
                        "text": "Plomberie > Outillage",
                        "image": "outillage-little.png",
                        "items" : [{
                                    "iItemId": 111,
                                    "text": "Plomberie > Outillage",
                                    "image": "outillage-little.png",
                                    "leaf": true
                        },
                        {
                                    "iItemId": 112,
                                    "text": "Plomberie > Outillage",
                                    "image": "outillage-little.png",
                                    "leaf": true
                        }],
                    },
                    {
                        "iItemId": 12,
                        "text": "Plomberie > Sanitaire",
                        "image": "outillage-little.png",
                        "items" : [{
                                    "iItemId": 121,
                                    "text": "Plomberie > Outillage",
                                    "image": "outillage-little.png",
                                    "leaf": true
                        },
                        {
                                    "iItemId": 122,
                                    "text": "Plomberie > Outillage",
                                    "image": "outillage-little.png",
                                    "leaf": true
                        }]
                    }]
           },
           {
               "iItemId": 2,
               "text": "Outillage",
               "image": "outillage-little.png",
                                    "leaf": true
           },
           {
               "iItemId": 3,
               "text": "Sanitaire",
               "image": "sanitaire-little.png",
                                    "leaf": true
           },
           {
               "iItemId": 4,
               "text": "Confort thermique",
               "image": "thermique-little.png",
                                    "leaf": true
           }
        ]
    }
    Archive.zip

  2. You should use TreeStore when using NestedList, not a regular Store.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Answers
    3356
    Vote Rating
    751
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You should use TreeStore when using NestedList, not a regular Store.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Feb 2012
    Location
    Paris
    Posts
    98
    Answers
    2
    Vote Rating
    1
    Tchinkatchuk is on a distinguished road

      0  

    Default


    Thanks !
    I am just the stupiest guy on earth.

    i have others trouble with 'has no method 'animation'" but I will find.

  5. #4
    Sencha User
    Join Date
    Feb 2012
    Location
    Paris
    Posts
    98
    Answers
    2
    Vote Rating
    1
    Tchinkatchuk is on a distinguished road

      0  

    Default


    OK, the animation error came from layout: "fit" that was not permitted here. I've deletd the line and it works great. Thanks.

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