1. #1
    Ext JS Premium Member
    Join Date
    Feb 2010
    Location
    Vancouver, BC
    Posts
    194
    Vote Rating
    0
    rkim is on a distinguished road

      0  

    Default Dynamically adding component in toolbar

    Dynamically adding component in toolbar


    I do add checkbox into toolbar dynamically (it was fine in 4.0)
    but with 4.1 upgrade, I can add as before as below with no problem

    Ext.getCmp("toolbarID").add(checkbox);

    but layout is bit messed up, displaying the items diagonally.

    If you add the same component statically, it renders fine.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,217
    Vote Rating
    859
    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 code:

    Code:
    Ext.create('Ext.panel.Panel', {
        renderTo    : Ext.getBody(),
        width       : 400,
        height      : 400,
        title       : 'Test',
        html        : 'Hello',
        dockedItems : [
            {
                xtype : 'toolbar',
                dock  : 'top',
                items : [
                    {
                        text    : 'Add Comp',
                        handler : function(btn) {
                            var toolbar = btn.up('toolbar');
    
                            toolbar.add({
                                xtype    : 'checkboxfield',
                                boxLabel : 'Checkbox'
                            });
                        }
                    }
                ]
            }
        ]
    });
    Got me this result:

    Screen Shot 2012-01-13 at 3.58.26 PM.png
    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.

  3. #3
    Ext JS Premium Member
    Join Date
    Feb 2010
    Location
    Vancouver, BC
    Posts
    194
    Vote Rating
    0
    rkim is on a distinguished road

      0  

    Default


    Thanks for your reply.
    Just noticed that the problem in our code is caused by
    layout:
    { overflowHandler: "Scroller"}

    and trying to figure out why it is causing our issue.
    It seems to fine with below code, only until the checkbox overflows.


    Quote Originally Posted by mitchellsimoens View Post
    This code:

    Code:
    Ext.create('Ext.panel.Panel', {
        renderTo    : Ext.getBody(),
        width       : 400,
        height      : 400,
        title       : 'Test',
        html        : 'Hello',
        dockedItems : [
            {
                xtype : 'toolbar',
               layout: {                    overflowHandler: "Scroller"
                },
                dock  : 'top',
                items : [
                    {
                        text    : 'Add Comp',
                        handler : function(btn) {
                            var toolbar = btn.up('toolbar');
    
                            toolbar.add({
                                xtype    : 'checkboxfield',
                                boxLabel : 'Checkbox'
                            });
                        }
                    }
                ]
            }
        ]
    });
    Got me this result:

    Attachment 30705

Thread Participants: 1