View Full Version : How to create a 3 state checkbox?

15 Jan 2010, 3:57 PM
I need a menu control with 3 states. If somebody has other approaches I would love to hear them...
My approach is to have checkboxes that are checked, unchecked, or disabled.

I am having trouble with the disabled->checked portion of this cycle.

How can I get a click from a disabled checkbox?
Is there a different event that works when the item is disabled?
Ideally I would like to disable the checkbox without supressing events and without losing the mouseover cursor of an enabled checkbox...how can I do this?

15 Jan 2010, 4:34 PM
Instead of using checkbox.disable(), I used checkbox.addClass('x-item-disabled') along with a property that I created with the checkbox called altDisabled.

here is my checkbox handler.

function SetAlertStateCheckHandler(caller, value)
814 if (value == true) {//was unchecked...disable and set unchecked
816 if (caller.altDisabled == true) {
817 caller.removeClass("x-item-disabled");
818 caller.altDisabled = false;
819 "do_stuff"
820 } else {
822 caller.setChecked(false, true);
823 caller.addClass("x-item-disabled");
824 caller.altDisabled = true;
825 //caller.disable();
826// caller.resumeEvents();
827 "do_stuff"
828 }
829 } else {//was checked
830 "do_stuff"
831 "do_stuff"
832 }