|
26 | 26 | <body>
|
27 | 27 | <div class="header">[ESUI EXAMPLE] - CheckBox and Radio</div>
|
28 | 28 | <div class="main">
|
29 |
| - <table cellpadding="5" cellspacing="0" border="0"> |
30 |
| - <tr> |
31 |
| - <td><input type="checkbox" value="1" ui="type:CheckBox;id:cb1" title="one" name="num"/></td> |
32 |
| - <td><input type="checkbox" value="2" ui="type:CheckBox;id:cb2" title="two" name="num"/></td> |
33 |
| - <td><input type="checkbox" value="3" ui="type:CheckBox;id:cb3" title="three" name="num"/></td> |
34 |
| - <td><div ui="type:Button;id:currCb">当前选中</div></td> |
35 |
| - <td><div ui="type:Button;id:selAll">全选</div></td> |
36 |
| - <td><div ui="type:Button;id:selInv">反选</div></td> |
37 |
| - </tr> |
38 |
| - <tr> |
39 |
| - <td><input type="radio" value="1" ui="type:Radio;id:r1" title="one" name="num2"/></td> |
40 |
| - <td><input type="radio" value="2" ui="type:Radio;id:r2" title="two" name="num2"/></td> |
41 |
| - <td><input type="radio" value="3" ui="type:Radio;id:r3" title="three" name="num2"/></td> |
42 |
| - <td colspan="3"><div ui="type:Button;id:currRadio">当前选中</div></td> |
43 |
| - </tr> |
44 |
| - <tr> |
45 |
| - <td><input type="radio" value="1" ui="type:Radio;id:x1" title="one"/></td> |
46 |
| - <td><input type="checkbox" value="3" ui="type:CheckBox;id:x3" title="three"/></td> |
47 |
| - <td colspan="3"><div ui="type:Button;id:xRender">Call Render Again</div></td> |
48 |
| - </tr> |
49 |
| - </table> |
| 29 | + <p> |
| 30 | + <input type="checkbox" value="1" ui="type:CheckBox;id:cb1" title="one" name="num"/> |
| 31 | + <input type="checkbox" value="2" ui="type:CheckBox;id:cb2" title="two" name="num"/> |
| 32 | + <input type="checkbox" value="3" ui="type:CheckBox;id:cb3" title="three" name="num"/> |
| 33 | + </p> |
| 34 | + <div> |
| 35 | + <div ui="type:Button;id:currCb">当前选中</div> |
| 36 | + <div ui="type:Button;id:selAll">全选</div> |
| 37 | + <div ui="type:Button;id:selInv">反选</div> |
| 38 | + <div ui="type:Button;id:selValues">选中值为2,3的项</div> |
| 39 | + </div> |
| 40 | + |
| 41 | + <p> |
| 42 | + <input type="radio" value="1" ui="type:Radio;id:r1" title="one" name="num2"/> |
| 43 | + <input type="radio" value="2" ui="type:Radio;id:r2" title="two" name="num2"/> |
| 44 | + <input type="radio" value="3" ui="type:Radio;id:r3" title="three" name="num2"/> |
| 45 | + </p> |
| 46 | + <div> |
| 47 | + <div ui="type:Button;id:currRadio">当前选中</div> |
| 48 | + <div ui="type:Button;id:radioSelValues">选中值为2的项</div> |
| 49 | + </div> |
| 50 | + |
| 51 | + <p> |
| 52 | + <input type="radio" value="1" ui="type:Radio;id:x1" title="one"/> |
| 53 | + <input type="checkbox" value="3" ui="type:CheckBox;id:x3" title="three"/> |
| 54 | + </p> |
| 55 | + <div> |
| 56 | + <div ui="type:Button;id:xRender">Call Render Again</div> |
| 57 | + </div> |
50 | 58 | </div>
|
51 | 59 |
|
52 | 60 | <script>
|
|
66 | 74 | esui.get('cb1').getGroup().selectInverse();
|
67 | 75 | };
|
68 | 76 |
|
| 77 | +esui.get('selValues').onclick = function () { |
| 78 | + esui.get('cb1').getGroup().selectByValues([2, 3]); |
| 79 | +}; |
| 80 | + |
69 | 81 | esui.get('currRadio').onclick = function () {
|
70 | 82 | alert( 'checked one:' + esui.get('r1').isChecked() );
|
71 | 83 | alert( 'checked two:' + esui.get('r2').isChecked() );
|
72 | 84 | alert( 'checked three:' + esui.get('r3').isChecked() );
|
73 | 85 | alert( 'group value:' + esui.get('r3').getGroup().getValue() );
|
74 | 86 | };
|
75 | 87 |
|
| 88 | +esui.get('radioSelValues').onclick = function () { |
| 89 | + esui.get('r2').getGroup().selectByValues([2]); |
| 90 | +}; |
| 91 | + |
76 | 92 | esui.get('xRender').onclick = function() {
|
77 | 93 | esui.get('x1').render();
|
78 | 94 | esui.get('x3').render();
|
|
0 commit comments