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

      0  

    Default treestore changes on expand

    treestore changes on expand


    Hi,
    I've got a MVC application., where I use treestore as menu. The treestore is loading from a php script.
    My store:
    Code:
    Ext.define('Statistics.store.Menu', {
        extend: 'Ext.data.TreeStore',
        model: 'Statistics.model.Menu',
        storeId: 'MenuStore',
        autoLoad: true,
        autoSync: true,
        
        proxy   : {
            type : 'ajax',
            url  : 'resources/scripts/get_menu.php?callback=1',
            reader: {
                type: 'json',
                successProperty: 'success'
            }
        }
        
        
    });
    And the model definition:
    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} 
        ],
    
    
    });
    When the application starts, it ajax requests the get_menu.php script
    Code:
    localhost/flexibee/resources/scripts/get_menu.php?callback=1&_dc=1356538422103&node=root&id=root
    
    After the application starts, the treepanel looks as following:
    Code:
    Home
    +Node1
    +Node2
    +Node3
    +Node4
    +Node5
    But when I try to expand any of the nodes, it fires another ajax request
    Code:
    localhost/flexibee/resources/scripts/get_menu.php?callback=1&_dc=1356538710990
    and it became this:
    Code:
    Home
    Home
    --Leaf1
    --Leaf2
    +Node2
    +Node3
    Home
    --Leaf1
    --Leaf2
    +Node5

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

      0  

    Default


    changed the store to:
    Code:
    Ext.define('Statistics.store.Menu', {
        extend: 'Ext.data.TreeStore',
    	storeId: 'MenuStore',
    	autoLoad: true,
    	autoSync: true,
        
        proxy   : {
            type : 'ajax',
            url  : 'resources/scripts/get_menu.php?callback=1',
    		reader: {
    			type: 'json',
    			successProperty: 'success'
    		}
        },
    	fields: ['text','dbName','leaf']
    	
    });
    and it works. looks like there's a bug