Results 1 to 4 of 4

Thread: How do I get two buttons to display side by side?

  1. #1
    Touch Premium Member
    Join Date
    Jun 2010
    Posts
    324
    Vote Rating
    2
      0  

    Default How do I get two buttons to display side by side?

    When I add them to a form, they display one on top of the other. I'd like one to be on the left and one to be on the right. Thanks in advance.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,382
    Vote Rating
    1529
      0  

    Default

    I add a container as an item to the formpanel with layout as hbox. That works pretty well for me.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

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

  3. #3
    Touch Premium Member
    Join Date
    Jun 2010
    Posts
    324
    Vote Rating
    2
      0  

    Default

    Thanks Mitchell, I will give that a shot.

  4. #4
    Sencha User
    Join Date
    Jan 2011
    Posts
    59
    Vote Rating
    0
      0  

    Default

    I was struggling with this for a while too, but ended up with the following code:

    Code:
    layout: {
    	type: 'hbox'
    },
    
    items: [{
    	xtype: 'spacer',
    }, {
    	layout: {
    		type: 'hbox'
    	},
    	items: [{
    		xtype: 'button',
    		ui: 'confirm',
    		text: 'Button 1'
    	},{
    		xtype: 'spacer',
    		// The amount of spacing between buttons
    		width: 20
    	}, {
    		xtype: 'button',
    		ui: 'action',
    		text: 'Button 2'
    	}]
    }, {
    	xtype: 'spacer',
    }]

Similar Threads

  1. How to align two buttons in two different side?
    By allpuser in forum Ext 2.x: Help & Discussion
    Replies: 24
    Last Post: 29 Nov 2016, 6:08 AM
  2. [Solved]Side-by-side Grids in a TableLayout not working
    By fzammetti in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 22 Jan 2009, 10:42 AM
  3. Close button for window comming on left side instead of right side
    By prakash.halan in forum Community Discussion
    Replies: 8
    Last Post: 26 Nov 2008, 6:26 AM
  4. Display TextField side by side
    By ktalasu in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 13 May 2008, 6:29 AM
  5. Server Side And Client Side Communication
    By YargicX in forum Community Discussion
    Replies: 3
    Last Post: 15 Apr 2008, 10:52 AM

Posting Permissions

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