-
Notifications
You must be signed in to change notification settings - Fork 0
/
codepen.js
90 lines (80 loc) · 3.09 KB
/
codepen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Ext.onReady(function () {
var ALL_ID = 1;
var data = {
text: 'SELECT ALL (id' + ALL_ID + ')',
expanded: true,
checked: false,
id: ALL_ID,
children: [
{ text: "id2 homework ", checked: false, expanded: true,
id: 2,
children: [
{ id: 3, checked: false, text: "id3 book report ", leaf: true },
{ id: 4, checked: false, text: "id4 algebra ", leaf: true}
] },
{ id: 5, checked: false, text: "id5 food ", expanded: true, children: [
{ id: 6, checked: false, text: "id6 meat ", leaf: true },
{ id: 7, checked: false, text: "id7 drinks ", children: [
{ id: 11, checked: false, text: "id11 soda ", leaf: true },
{ id: 12, checked: false, text: "id12 milk ", leaf: true }
]}
] },
{ id: 8, checked: false, text: "id8 plans ", expanded: true, children: [
{ id: 9, checked: false, text: "id9 vacation ", leaf: true },
{ id: 10, checked: false, text: "id10 rule the world ", leaf: true}
] }
]
};
var store = Ext.create('Ext.data.TreeStore', {
fields: ['text' , 'id'],
root: data
});
Ext.create('Ext.ux.grid.TriStateTree', {
store: store,
ALL_ID: ALL_ID,
width: 600,
height: 300,
tbar: [
'<a href="http://wap7.ru/folio/ext-tri-state-tree/" target="_top">Doc</a>'
,
{ xtype: 'button',
text: 'Check Root',
handler: function () {
this.up('panel').setSelections([ALL_ID])
}
},
{ xtype: 'button',
text: 'Uncheck Root',
handler: function () {
this.up('panel').uncheckRoot();
}
},
{ xtype: 'button',
text: 'Check 3,4,7,10',
handler: function () {
this.up('panel').setSelections([ 3, 4, 7, 10])
}
},
{ xtype: 'button',
text: 'Get: Id only, Leafs only',
handler: function () {
Ext.MessageBox.show({
title: 'Selected Nodes Id only, Leafs only',
msg: JSON.stringify(this.up('panel').getSelections(true, true), null, 4),
icon: Ext.MessageBox.INFO
});
}
},
{ xtype: 'button',
text: 'Get: as objects, with branches',
handler: function () {
Ext.MessageBox.show({
title: 'Selected Nodes with branches',
msg: JSON.stringify(this.up('panel').getSelections(), null, 4),
icon: Ext.MessageBox.INFO
});
}}
],
renderTo: 'grid-example'
});
});