1. #1
    Sencha Premium Member mik3e's Avatar
    Join Date
    Jan 2012
    Location
    Vienna / Austria
    Posts
    81
    Vote Rating
    1
    mik3e is on a distinguished road

      0  

    Default Troubles with Treegrid / Ext.tree.Panel

    Troubles with Treegrid / Ext.tree.Panel


    Hi Guys,

    I tried to use a Treegrid in my MVC passtern with 4.1 Beta 2 and got the following problem:
    As soon as I load my view with the treegrid, the following error raises:

    treepanel_exception.jpg

    In the background you can see the gridpanel that is loaded. I already tried different solutions, but can´t find the correct one till now.

    Maybe it´s also an error in my json file, but I also can´t find one there.

    Here is the code - I used the http://docs.sencha.com/ext-js/4-0/ex...ee/treegrid.js example to get started.

    Model:

    Code:
    Ext.define('LT.model.Competition', {
        extend: 'Ext.data.Model',
    
        fields: [
            {name: 'task', type: 'string'},
            {name: 'user', type: 'string'}
        ],
        
        proxy: {
            type: 'ajax',
            url: 'treegrid.json',
            reader: {
                type: 'json',
                idProperty: 'id',
                root: 'data'
            }
        },
        folderSort: true
    
    });

    Store:


    Code:
    Ext.define('LT.store.Competition', {
        extend: 'LT.store.base.BaseTreeStore',
        requires: ['LT.model.Competition'],
        model: 'LT.model.Competition'
    
    });
    View:

    Code:
    Ext.define('LT.view.competition.List', {
        extend: 'Ext.tree.Panel',
        alias: 'widget.competition_list',
        title: __('Competitions'),
        requires: ['LT.store.Competition'],
        store: 'Competition',
        
        collapsible: true,
        useArrows: true,
        singleExpand: true,
        rootVisible: false,
        
        viewConfig: {
            loadMask: false
        },
    
        columns: [{
            xtype: 'treecolumn', //this is so we know which column will show the tree
            text: 'Name',
            flex: 1,
            dataIndex: 'task'
        },{
            text: 'Season',
            flex: 1,
            dataIndex: 'user'
        }],

    Controller:

    Not required for this example.

    So if anyone has an idea - please be so kind to give me a hint
    I'll start debugging the ExtJS core now...

    Cheers,
    Mike

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,064
    Vote Rating
    851
    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


    Does this happen by itself or do you have to do something to cause it?
    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.

  3. #3
    Sencha Premium Member mik3e's Avatar
    Join Date
    Jan 2012
    Location
    Vienna / Austria
    Posts
    81
    Vote Rating
    1
    mik3e is on a distinguished road

      0  

    Default


    It happens after the view is loaded (looks like after the autoload finishes) and if you try to expand a tree in the grid panel.

  4. #4
    Sencha Premium Member mik3e's Avatar
    Join Date
    Jan 2012
    Location
    Vienna / Austria
    Posts
    81
    Vote Rating
    1
    mik3e is on a distinguished road

      0  

    Cool


    After some research I found the solution:

    In my proxy I´ve defined the "idProperty" with name "id":

    Code:
    proxy: {
            type: 'ajax',
            url: '../../data/competition.json',
            reader: {
                type: 'json',
                idProperty: 'id',
                root: 'data'
            }
        }
    And in my json file (cause it´s only a test case) the id is NOT UNIQUE in the node list:

    Code:
    ....
    name:'Testnode',
            id: '47110815',
            active: 'true',
            data:[{
                name:'Subnode 1',
                id: '47110815',
                active: 'true',
                data:[{
                    name:'Subnode 3',
                    id: '47110815',
                    active: 'true',
                    leaf: true
                },{
    ....
    And this is the reason for the error message described above..

Thread Participants: 1