Results 1 to 4 of 4

Thread: Troubles with Treegrid / Ext.tree.Panel

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha Premium Member mik3e's Avatar
    Join Date
    Jan 2012
    Location
    Vienna / Austria
    Posts
    81
    Vote Rating
    1
      0  

    Default 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 cant find the correct one till now.

    Maybe its also an error in my json file, but I also cant 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Vote Rating
    1271
      0  

    Default

    Does this happen by itself or do you have to do something to cause it?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium Member mik3e's Avatar
    Join Date
    Jan 2012
    Location
    Vienna / Austria
    Posts
    81
    Vote Rating
    1
      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
      0  

    Cool

    After some research I found the solution:

    In my proxy Ive 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 its 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..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •