Results 1 to 2 of 2

Thread: Width problem with ButtonGroup in Toolbar

  1. #1

    Question Width problem with ButtonGroup in Toolbar

    I have the following code

    Code:
    <div id="testdiv2"></div>
    <script>
    var tlbTools = new Ext.Toolbar({
      width: 400,
      id: 'tlbTools',
      });
    var groupOptions = new Ext.ButtonGroup({
      xtype: 'buttongroup',
      id: 'groupOptions',
      columns: 1,
      layout: 'table',
    });
    var btnAccept = new Ext.Button({
      xtype: 'button',
      text: 'testme',
      id: 'btnAccept',
      tooltip: 'i am a tooltip',
      scale: 'small',
    });
    
    groupOptions.add(btnAccept);
    tlbTools.add(groupOptions);
    
    tlbTools.render('testdiv2');
    </script>
    The problem is that the width of the ButtonGroup is 6px even if i set the width to a specific width.

    Note: If i replace ButtonGroup with Panel, everything works smoothly, but i don t want a Panel. Can you help me, what i m doing wrong? (it's strange because ButtonGroup is just an extension of the Panel class)

    I would like to use the add methods of the Components because my code is automatically generated from php, and it's easier like that.

    Is there anything that i m missing? Thank you in advance.
    Attached Images Attached Images

  2. #2

    Lightbulb Using Ext.onReady...

    I put the code above in an

    Code:
    Ext.onReady( function() {
    // ... the code here
    })
    and the problem was solved.

    It seems that for a strange reason, if i m using a Panel the widths are calculated nicely, but if i m using a ButtonGroup (which is almost the same) inside a Toolbar, the widths are not yet calculated correctly and that's why i have to wait for the page to load first.

Similar Threads

  1. Toolbar buttongroup is reseting width once the grid loads with data
    By shriniv78 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 25 Jul 2010, 12:28 PM
  2. Replies: 4
    Last Post: 3 Jun 2009, 11:43 AM
  3. [2.0 M1] Toolbar / ButtonGroup behaviours
    By Rvanlaak in forum Ext GWT: Bugs (2.x)
    Replies: 7
    Last Post: 26 May 2009, 1:53 AM
  4. Replies: 7
    Last Post: 9 Apr 2009, 3:18 AM

Tags for this Thread

Posting Permissions

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