Results 1 to 4 of 4

Thread: Styling button text to auto-wrap

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Renfrew
    Posts
    74
    Answers
    1
    Vote Rating
    2
      0  

    Default Answered: Styling button text to auto-wrap

    In a post by Mitchell Simoens, he sugggested to override the x-button-label that sets these properties: overflow : hidden, white-space : no-wrap and text-overflow : ellipsis. I tried making a class that sets the white-space to normal and applying it to the cls: field of my button.

    Unfortunately, the button text isn't wrapping. Inspecting the elements it appears that my class is being applied to the button, but the label of the button is using the x-button-label class. Since I don't really want to change the style of all my buttons, just a few, how can I set the label class of my button?

    Thanks.

  2. Code:
    new Ext.Container({
        fullscreen : true,
        items      : [
            {
                xtype : 'button',
                text  : 'Some long text',
                width : 100,
                cls   : 'wrap-button'
            }
        ]
    });
    Code:
    .wrap-button .x-button-label {
        white-space: normal;
        text-overflow: clip;
        overflow: visible;
    }

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,336
    Answers
    3885
    Vote Rating
    1297
      1  

    Default

    Code:
    new Ext.Container({
        fullscreen : true,
        items      : [
            {
                xtype : 'button',
                text  : 'Some long text',
                width : 100,
                cls   : 'wrap-button'
            }
        ]
    });
    Code:
    .wrap-button .x-button-label {
        white-space: normal;
        text-overflow: clip;
        overflow: visible;
    }
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

  4. #3
    Sencha User
    Join Date
    Nov 2011
    Location
    Renfrew
    Posts
    74
    Answers
    1
    Vote Rating
    2
      0  

    Default

    That is straight-forward css, I should know better. Thank you.

  5. #4
    Sencha User
    Join Date
    Apr 2012
    Posts
    13
    Vote Rating
    0
      0  

    Default

    How to wrap text in a button for IE10 in sencha 2.2
    as this is not working for IE10 with windows theme.

Posting Permissions

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