Opened 13 years ago

Closed 12 years ago

#2299 closed defect (fixed)

Disabling checkbox does not change style

Reported by: trac.dojotoolkit.org@… Owned by: davidb
Priority: high Milestone: 0.9beta
Component: Widgets Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

Disabling a checkbox in code does not change the checkbox css style to show it being disabled. I found I have to call _setInfo() to update it:

var myCheckbox = dojo.widget.byId("idMyCheckbox");
myCheckbox.disabled = true;
myCheckbox._setInfo();

At a higher level, input widgets need common methods to enable and disable them. setDisable(bool) in Button.js should be moved to a superclass, and methods enable() and disable() would also be useful.

Attachments (1)

disablecbfix.diff (3.4 KB) - added by davidb 12 years ago.
fixes bug. adds test to confirm bug. removes unsupported reset from test page.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 13 years ago by bill

Of course setting an attribute won't affect the widget because the widget doesn't know that you changed the value. You need to call enable()/disable() functions. However, I'm not sure those are working either, so I'll leave this bug open for now.

comment:2 Changed 13 years ago by trac.dojotoolkit.org@…

I realize just changing the attribute won't trigger anything, which is why I have to call _setInfo. enable() and disable() in widgets.js just set the disabled attribute as well, without changing any css. These methods should be overridden by about all the widgets, but aren't. There's no common way to disable widgets, but there should be (using enable() and disable() would be good).

comment:3 Changed 12 years ago by Douglas Hays

Owner: changed from bill to Douglas Hays

comment:4 Changed 12 years ago by Douglas Hays

Owner: changed from Douglas Hays to davidb

This still seems to be a problem in the new 0.9 checkbox. If _setDisabled() is changed to call this._updateView(); and _updateView() is changed to not call this._setDisabled(w.disabled); then the checkbox shows up as disabled using disable(). But this may have side-effects that I'm not aware of.

comment:5 Changed 12 years ago by davidb

Status: newassigned
Version: 0.4.10.9

comment:6 Changed 12 years ago by bill

Milestone: 0.9beta

Changed 12 years ago by davidb

Attachment: disablecbfix.diff added

fixes bug. adds test to confirm bug. removes unsupported reset from test page.

comment:7 Changed 12 years ago by Douglas Hays

Resolution: fixed
Status: assignedclosed

(In [8506]) Fixes #2299. Proxy commit for davidb. Added disabled/enable buttons to test_Checkbox.html to recreate the problem and removeed the unsupported reset button.

Note: See TracTickets for help on using tickets.