Results 1 to 4 of 4

Thread: Help with layout - VBox with two grids set to resizable: true, not resizing.

  1. #1
    Sencha User JamieMason's Avatar
    Join Date
    Apr 2010
    Location
    Leeds, UK
    Posts
    42

    Question Answered: Help with layout - VBox with two grids set to resizable: true, not resizing.

    Video here: http://dl.dropbox.com/u/12326563/vboxresize.mov

    I have a VBox containing two grids, I want them to start with a size set by the flex values of 1 and 2 - then be resizable from there on by using the handles. The handles appear fine but the elements don't resize.

    What am I doing wrong please? Thanks!

    Code:
    {    xtype: 'container',
        layout: {
            align: 'stretch',
            type: 'vbox'
        },
        items: [
            {
                xtype: 'gridpanel',
                id: 'availableBatches',
                resizable: true,
                resizeHandles: 's',
                title: 'Available Batches',
                region: 'north',
                flex: 2,
                columns: [
                    {
                        xtype: 'gridcolumn',
                        dataIndex: 'string',
                        text: 'Name'
                    },
                    {
                        xtype: 'numbercolumn',
                        dataIndex: 'number',
                        text: 'Batch Count'
                    },
                    {
                        xtype: 'numbercolumn',
                        dataIndex: 'number',
                        text: 'Description'
                    }
                ],
                viewConfig: {
    
    
                }
            },
            {
                xtype: 'gridpanel',
                resizable: true,
                resizeHandles: 'n',
                title: 'My Batches',
                region: 'center',
                flex: 1,
                columns: [
                    {
                        xtype: 'gridcolumn',
                        dataIndex: 'string',
                        text: 'Name'
                    },
                    {
                        xtype: 'gridcolumn',
                        dataIndex: 'string',
                        text: 'Item Count'
                    },
                    {
                        xtype: 'gridcolumn',
                        dataIndex: 'string',
                        text: 'Complete'
                    }
                ],
                viewConfig: {
    
    
                }
            }
        ]
    }

  2. VBox won't allow you to do this. The layout will manage the height and width (since you have align: 'stretch')

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    VBox won't allow you to do this. The layout will manage the height and width (since you have align: 'stretch')
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  4. #3
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585

    Default

    Hack:

    Code:
    Ext.create('Ext.container.Container', {
        height: 300,
        renderTo: Ext.getBody(),
        width: 300,
        defaults: {
            listeners: {
                resize: function(resizeChild) {
                    var cont = resizeChild.ownerCt;
    
                    // Need this because the doLayout() call also fires resize
                    if (cont.doingResize) {
                        return;
                    }
    
                    cont.doingResize = true;
    
                    // Easier way to do this?
                    var otherChild = Ext.Array.remove([cont.getComponent(0), cont.getComponent(1)], resizeChild)[0];
    
                    resizeChild.flex = null;
                    otherChild.flex = 1;
                    
                    cont.doLayout();
    
                    cont.doingResize = false;
                }
            }
        },
        items: [
            {
                flex: 1,
                resizable: true,
                resizeHandles: 's',
                title: 'P1'
            }, {
                flex: 1,
                resizable: true,
                resizeHandles: 'n',
                title: 'P2'
            }
        ],
        layout: {
            align: 'stretch',
            type: 'vbox'
        }
    });

  5. #4
    Sencha User JamieMason's Avatar
    Join Date
    Apr 2010
    Location
    Leeds, UK
    Posts
    42

    Default

    Sorry for the slow reply guys, I appreciate your help. Marking as answered.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •