PDA

View Full Version : Checkbox inside a button



Voyd
3 Feb 2012, 2:46 PM
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] | | | |
| | | | | | | | | | | | | | | |
---------------------------

vietits
3 Feb 2012, 3:37 PM
You can use iconCls ( or cls or preseedCls) for this purpose.

Farish
4 Feb 2012, 1:43 AM
here is the solution. you will need to adjust it a little to make it look better.



{
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" />');
}

}