1. #1
    Sencha User sunrong's Avatar
    Join Date
    Jun 2010
    Posts
    35
    Vote Rating
    0
    sunrong is on a distinguished road

      0  

    Default how to add treePanel to a viewport

    how to add treePanel to a viewport


    Code:
    Ext.create('Ext.container.Viewport', {
            layout: 'border',
            items: [{
                region: 'north',
                html: '<h1 class="x-panel-header">Page Title</h1>',
                autoHeight: true,
                border: false,
                margins: '0 0 5 0'
            }, {
            region: 'west',
            collapsible: true,
            title: 'Navigation',
            width: 150,
            items: tree
            },......
    Code:
    var tree = Ext.create('Ext.tree.Panel', {
            store: store,
            viewConfig: {
                plugins: {
                    ptype: 'treeviewdragdrop'
                }
            },
            region:'west',
           contentEl:'west',
          id:'west-panel',
            layout:'accordion',
            height: 300,
            width: 250,
            title: 'function',
            useArrows: true,
            dockedItems: [{
                xtype: 'toolbar',
                items: [{
                    text: 'Expand All',
                    handler: function(){
                        tree.expandAll();
                    }
                }, {
                    text: 'Collapse All',
                    handler: function(){
                        tree.collapseAll();
                    }
                }]
            }]
        });
    the code does not work?how to fix it? Thanks!
    sun

  2. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    115
    vietits is a splendid one to behold vietits is a splendid one to behold vietits is a splendid one to behold vietits is a splendid one to behold vietits is a splendid one to behold vietits is a splendid one to behold

      0  

    Default


    Try to fix your code as below:
    Code:
    var tree = Ext.create('Ext.tree.Panel', {
        store: store,
        viewConfig: {
            plugins: {
                ptype: 'treeviewdragdrop'
            }
        },
    //  region:'west',
    //  contentEl:'west',
        id:'west-panel',
    //  layout:'accordion',
        height: 300,
        width: 250,
        title: 'function',
        useArrows: true,
        dockedItems: [{
            xtype: 'toolbar',
            items: [{
                text: 'Expand All',
                handler: function(){
                    tree.expandAll();
                }
            }, {
                text: 'Collapse All',
                handler: function(){
                    tree.collapseAll();
                }
            }]
        }]
    });

Thread Participants: 1

Tags for this Thread