1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Renfrew
    Posts
    74
    Vote Rating
    2
    Answers
    1
    tmcdonald is on a distinguished road

      0  

    Default Answered: Styling button text to auto-wrap

    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 - Senior Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,744
    Vote Rating
    927
    Answers
    3585
    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

      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 @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    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
    Vote Rating
    2
    Answers
    1
    tmcdonald is on a distinguished road

      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
    dbora is on a distinguished road

      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.

Thread Participants: 2