1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    3
    Vote Rating
    0
    oncom is on a distinguished road

      0  

    Default Answered: How to show content in layout after click tree node

    Answered: How to show content in layout after click tree node


    Hello everybody,
    i am stuck here.

    i have a tree like this

    MyTree.js
    Code:
    var store = Ext.create('Ext.data.TreeStore', {
        proxy: {
            type: 'ajax',
            url: 'application/controllers/itemlist.php',
            node: 'id'
        },
        root: {
            text: 'Root Node',
            id: 'root_node',
            expanded: true
        }
    });
    
    
    var treePanel = Ext.create('Ext.tree.Panel', {
        id: 'tree-panel',
        region:'north',
        autoHeight: true, 
        minSize: 150,
        rootVisible: false,
        border: false,
        flex: 3,
        store: store
    });
    
    
    var detail = Ext.create('Ext.panel.Panel', {
        title: 'Details',
        region: 'south',
        height: 240,
        border: false,
        bodyStyle: 'padding: 5px;',
        autoScroll: true,
        flex: 1,
        html: '<p style="margin: 5px;">When you select a layout from the tree, additional details will display here.</p>'
    });    
    
    
    Ext.define('AM.view.layout.MyTree', {
        extend: 'Ext.container.Container',
        alias: 'widget.mytreepanel',
        layout: {
            type: 'vbox',
            align: 'stretch'
        },
        items: [ treePanel, detail ]
    });
    the tree is in region 'west', so when i click the node tree, i want to display tab panel in the center.

    for code in the tab panel is

    MyContent.js
    Code:
    Ext.define('AM.view.layout.MyContent', {
        extend: 'Ext.panel.Panel',
        alias: 'widget.contentpanel',
        
        activeItem: 0, 
        layout: {
            type: 'card',
            deferredRender: true
        },
        border: false,
        region: 'center'
    });
    how do i make it happen?

  2. I see you are using the region config but then using vbox layout. The region config will only work for border layout. You can add/remove items to a center region of a border layout.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,710
    Vote Rating
    436
    Answers
    3113
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    I see you are using the region config but then using vbox layout. The region config will only work for border layout. You can add/remove items to a center region of a border layout.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    3
    Vote Rating
    0
    oncom is on a distinguished road

      0  

    Default


    thank you a lot, Mitchell. finally fix this problem.