Skip to content

Commit 6914815

Browse files
committed
added readme
1 parent b466816 commit 6914815

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Description
2+
3+
The `TristateCheckbox` allows any checkbox element to have an extra state defined.
4+
this state means that some of it's children are selected, but not all of them
5+
6+
This gets determined by a built in `dependencySelector`.
7+
it is customizable to almost any context
8+
9+
one tristate can even set the state of another, this is all built in via events
10+
11+
## Basic Usage
12+
13+
<form id="basic-usage">
14+
<table>
15+
<tr>
16+
<td>Basic tri-state (has little to no function like this) : </td>
17+
<td>
18+
<input id="cb-1" type="checkbox"/>
19+
</td>
20+
</tr>
21+
</table>
22+
</form>
23+
<script>
24+
document.observe('dom:loaded', function() {
25+
new TriStateCheckbox('cb-1');
26+
});
27+
</script>
28+
29+
## Advanced Usage
30+
31+
<form id="adv-usage">
32+
<table>
33+
<tr>
34+
<td>normal tri-state : </td>
35+
<td>
36+
<input id="cb-a-1" type="checkbox"/>
37+
</td>
38+
</tr>
39+
<tr>
40+
<td>child 1 : </td>
41+
<td>
42+
<input id="cb-c-1" type="checkbox"/>
43+
</td>
44+
</tr>
45+
<tr>
46+
<td>child 2 : </td>
47+
<td>
48+
<input id="cb-c-2" type="checkbox"/>
49+
</td>
50+
</tr>
51+
<tr>
52+
<td>child 3 : </td>
53+
<td>
54+
<input id="cb-c-3" type="checkbox"/>
55+
</td>
56+
</tr>
57+
</table>
58+
</form>
59+
<script>
60+
document.observe('dom:loaded', function() {
61+
new TriStateCheckbox('cb-a-1', {
62+
dependantSelector: 'form#adv-usage input[id^="cb-c"]'
63+
});
64+
});
65+
</script>

0 commit comments

Comments
 (0)