1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    27
    Vote Rating
    -1
    ferchotipin is an unknown quantity at this point

      0  

    Default loading dataIndex tree.Panel

    loading dataIndex tree.Panel


    Hi, I'm doing a really simple tree.Panel, and Im trying to use some columns but it doesnt load the dataindex apart from the 'text' one... this is the code:

    Code:
    var store = Ext.create('Ext.data.TreeStore', {            
                root : {
                    expanded : true,
                    children : [{
                                text : "detention",
                                description : 'asdfasdf',
                                leaf : true
                            }, {
                                text : "homework",
                                description : "asdfasdf",
                                children : [{
                                            text : "book report",
                                            description : 'hola',
                                            leaf : true
                                        }, {
                                            text : "alegebra",
                                            description : "haha",
                                            leaf : true
                                        }]
                                
                            }, {
                                text : "buy lottery tickets",
                                description : "kajsdf",
                                leaf : true
                            }]
                }
            });
    
    
    Ext.define('managerUserText', {
                extend : 'Ext.tree.Panel',
    
    
                initComponent : function() {
                    var me = this;
                    me.store = store;
                    me.fields = ['text', 'des'];
                    me.columns = [{
                                xtype : 'treecolumn',
                                text : 'i_Property',
                                dataIndex : 'text',
                                width : 200
                            }, {
                                text : 'i_Description',
                                dataIndex : 'description',
                                flex : 1,
                                width : 200
                            }];
                    me.callParent(arguments);
                }
            })
    Thank you for any help...

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    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 shouldn't use Ext.create outside of Ext.define or Ext.onReady. If you have more than one instance of this tree panel, it will share the same store.

    The issue is your store didn't know about the description field:

    Code:
    Ext.define('managerUserText', {
        extend : 'Ext.tree.Panel',
    //TODO NEED AN ALIAS
    
        initComponent : function() {
            var me = this;
    
            me.store = Ext.create('Ext.data.TreeStore', {
                fields : ['text', 'description'],
                root : {
                    expanded : true,
                    children : [{
                        text : "detention",
                        description : 'asdfasdf',
                        leaf : true
                    }, {
                        text : "homework",
                        description : "asdfasdf",
                        children : [{
                            text : "book report",
                            description : 'hola',
                            leaf : true
                        }, {
                            text : "alegebra",
                            description : "haha",
                            leaf : true
                        }]
                    }, {
                        text : "buy lottery tickets",
                        description : "kajsdf",
                        leaf : true
                    }]
                }
            });
    
            me.columns = [{
                xtype : 'treecolumn',
                text : 'i_Property',
                dataIndex : 'text',
                width : 200
            }, {
                text : 'i_Description',
                dataIndex : 'description',
                flex : 1,
                width : 200
            }];
    
            me.callParent(arguments);
        }
    });
    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.

Thread Participants: 1

Tags for this Thread