1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    37
    Vote Rating
    1
    Voyd is on a distinguished road

      0  

    Default Unanswered: Checkbox inside a button

    Unanswered: Checkbox inside a button


    I was wondering if there was a way to insert a check box inside of a button. My user likes the idea of a toggle button but thinks it isn't as intuitive as a checkbox. So of course their solution, a toggle button with a title text and when toggled, not only selects itself, but checks the check box inside of it. Any ideas?

    ---------------------------
    | | | | | | | | | | | | | | | |
    | click me [X] | | | |
    | | | | | | | | | | | | | | | |
    ---------------------------

  2. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    115
    Answers
    346
    vietits is a splendid one to behold vietits is a splendid one to behold vietits is a splendid one to behold vietits is a splendid one to behold vietits is a splendid one to behold vietits is a splendid one to behold

      0  

    Default


    You can use iconCls ( or cls or preseedCls) for this purpose.

  3. #3
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,099
    Vote Rating
    96
    Answers
    113
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    here is the solution. you will need to adjust it a little to make it look better.

    Code:
                {
                        xtype: 'button',
                        height: 20,
                        width: 100,
                        html: 'text <input type="checkbox" />',
                        enableToggle: true,
                        toggleHandler: function(button, state)
                            {
                                if(state)
                                    button.update('text <input type="checkbox" checked="checked" />');
                                else
                                    button.update('text <input type="checkbox" />');                                
                            }
    
                    }

Thread Participants: 2