1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    23
    Vote Rating
    0
    sbodanapu is on a distinguished road

      0  

    Default Unanswered: Not able to view simple tree Grid with the local data

    Unanswered: Not able to view simple tree Grid with the local data


    Hi..please help me here..

    I am trying to display a tree grid with hard coded data..I am not getting any errors and also not able to display any data.but store has all the data which is needed.. Please help me if i am going wrong any where

    Code:
    Ext.onReady(function() {
    Ext.create('Ext.tree.Panel', {title: 'Books',
         width: 500, height: 300,
         
         collapsible: true,
         useArrows: true,
         rootVisible: true,
         store: store,
         multiSelect: true,
         singleExpand: true,
        columns: [
          { 
             xtype: 'treecolumn',
              text: 'Object',
              flex: 2,
              sortable: true,
              dataIndex: 'object'
           },
           {
              text: 'Name',
              flex: 1,
              dataIndex: 'name',
              sortable: true
           } ,
           {
              text: 'Quantity',
              flex: 1,
              dataIndex: 'quantity',
              sortable: true
           } 
         ],
         renderTo: Ext.getBody()
         
    });
    });
    
     var store=Ext.create('Ext.data.TreeStore', {
        storeId:'simpsonsStore',
        id:'storeName',
        autoLoad:true,
        fields:[{'type':'int','name':'id','mapping':'id'},{'name':'object','mapping':'object'}, {'name':'name','mapping':'name'},{ 'name':'quantity','mapping':'quantity'}],idProperty: 'id',
        data:{'record':[
            { 'id':1,'object':'fruit','name': 'apple','quantity':'40','leaf':true,'parentId':1,'iconCls':'task-folder'},
            { 'id':2,'object':'PC','name': 'HP','quantity':'2',iconCls:'task-folder','expanded':true ,
        children: [
                {
           'id':21,
                    'object': "sand",
                    'name': "apple",
                    'quantity': "50 kg ",
                    'leaf': true,
        'parentId':2
                },
                {
           'id':22,
                    'object': "mud",
                    'name': "mango",
                    'quantity': "100 kg ",
                    'leaf': true,
        'parentId':2
                }
               ]
      },
      {'id':3, 'object':'pen','name': 'cello','quantity':'30'},
        ]},
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'record'
            }
        }
    });
    Thanks,
    Sandeep

  2. #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


    This is working for me using the root config:

    Code:
    var store = Ext.create('Ext.data.TreeStore', {
        fields : [
            'id',
            'object',
            'name',
            'quantity'
        ],
        root   : {
            expanded : true,
            children : [
                {
                    id       : 1,
                    object   : 'fruit',
                    name     : 'apple',
                    quantity : '40',
                    leaf     : true,
                    parentId : 1,
                    iconCls  : 'task-folder'
                },
                {
                    id       : 2,
                    object   : 'PC',
                    name     : 'HP',
                    quantity : '2',
                    iconCls  : 'task-folder',
                    expanded : true,
                    children : [
                        {
                            id       : 21,
                            object   : "sand",
                            name     : "apple",
                            quantity : "50 kg ",
                            leaf     : true,
                            parentId : 2
                        },
                        {
                            id       : 22,
                            object   : "mud",
                            name     : "mango",
                            quantity : "100 kg ",
                            leaf     : true,
                            parentId : 2
                        }
                    ]
                },
                {
                    id       : 3,
                    object   : 'pen',
                    name     : 'cello',
                    quantity : '30'
                }
            ]
        }
    });
    
    Ext.create('Ext.tree.Panel', {
        title        : 'Books',
        width        : 500,
        height       : 300,
        collapsible  : true,
        useArrows    : true,
        rootVisible  : true,
        store        : store,
        multiSelect  : true,
        singleExpand : true,
        columns      : [
            {
                xtype     : 'treecolumn',
                text      : 'Object',
                flex      : 2,
                sortable  : true,
                dataIndex : 'object'
            },
            {
                text      : 'Name',
                flex      : 1,
                dataIndex : 'name',
                sortable  : true
            } ,
            {
                text      : 'Quantity',
                flex      : 1,
                dataIndex : 'quantity',
                sortable  : true
            }
        ],
        renderTo     : Ext.getBody()
    });
    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

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