Opened 10 years ago
Closed 10 years ago
#12682 closed enhancement (duplicate)
Tri-State Checkbox
Reported by: | Gu Yi, He | Owned by: | dante |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | DojoX Form | Version: | 1.6.0 |
Keywords: | tri-state checkbox | Cc: | [email protected]…, [email protected]…, [email protected]… |
Blocked By: | Blocking: |
Description
TriStateCheckBox? is check box that can be checked, unchecked, or of an indeterminate state.
Most often, TriStateCheckBox? can be found in a tree.
TriStateCheckBox? behavior:
- When no children elements are selected, the parent element is also unselected.
- When all the children elements are selected, the parent element is selected.
- When the child elements are both selected and unselected, the parent element is in an indeterminate state. Selecting a parent indeterminate state check box selects all items. Selecting the parent check box a third time returns the check box to the indeterminate state.
API:
TriStateCheckBox? almost shares the same api of diji.form.CheckBox?. Here's a list of difference:
Control the state of a TriStateCheckBox? :
.set("checked", true)
.set("checked", false)
.set("checked", "mixed") (dijit.form.CheckBox? does not have this state).
Set value for a TriStateCheckBox:
.set("value", foo) same as CheckBox?
Set values for a TriStateCheckBox:
.set("values", [foo, bar]) foo/bar is the value to be submitted when the state of TriStateCheckBox? is checked/mixed.
Set states cycle for a TriStateCheckBox::
.set("states", [true, false])
Dup of #7513 and #7514.