forked from syncfusion/ej2-vue-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselection.vue
172 lines (170 loc) · 6.36 KB
/
selection.vue
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<template>
<div>
<div class="col-md-9 control-section">
<div class="content-wrapper">
<ejs-gantt ref='gantt' id="Selection"
:dataSource= "data"
:height = "height"
:highlightWeekends= 'true'
:allowSelection = 'true'
:taskFields= "taskFields"
:labelSettings= "labelSettings"
:treeColumnIndex= "1"
:selectionSettings= "selectionSettings"
:splitterSettings= "splitterSettings"
:projectStartDate= "projectStartDate"
:projectEndDate= "projectEndDate">
</ejs-gantt>
</div>
</div>
<div class="col-md-3 property-section">
<table id="property" title="Properties" style="width: 100%">
<tr>
<td style="width: 100%">
<div style="fontSize: 15px">Selection Mode</div>
</td>
</tr>
<tr>
<td style="width: 100%;padding-right: 10px">
<div style="width: 150px">
<ejs-dropdownlist ref='selectionmode' id='selectionmode' width='110px' :dataSource='selectionModeData' value='Row' :fields='selectionModeFields'></ejs-dropdownlist>
</div>
</td>
</tr>
<tr>
<td style="width: 100%">
<div style="fontSize: 15px">Selection Type</div>
</td>
</tr>
<tr>
<td style="width: 100%;padding-right: 10px">
<div style="width: 150px">
<ejs-dropdownlist ref='selectiontype' width='110px' id='selectiontype' :dataSource='selectionTypeData' value='Single' :fields='selectionTypeFields'></ejs-dropdownlist>
</div>
</td>
</tr>
<tr>
<td style="width: 100%">
<div style="fontSize: 15px">Toggle Selection</div>
</td>
</tr>
<tr>
<td style="width: 100%;padding-right: 10px">
<div style="width: 150px">
<ejs-dropdownlist ref='toggle' width='110px' id='toggle' :dataSource='selectionToggleData' :value='toggleValue' :fields='selectionToggleFields'></ejs-dropdownlist>
</div>
</td>
</tr>
<tr>
<td style="width: 30%">
<div>
<ejs-button ref='perform' v-on:click.native="perform">Update</ejs-button>
</div>
</td>
</tr>
</table>
</div>
<div id="action-description">
<p> The selection feature enables you to highlight row or cell. It can be enabled by setting
<code>allowSelection</code> to <code>true</code>.</p>
</div>
<div id="description">
<p>
The Gantt component supports two types of selection that can be set by using the <code>selectionSettings.type</code> property.
They are:
</p>
<ul>
<li><code>Single</code> - Sets a single value by default and allows only selection of a single row or a cell.</li>
<li><code>Multiple</code> - Allows you to select multiple rows or cells. To perform the multi-selection, press and hold the CTRL key and click the desired rows or cells.</li>
</ul>
<p>
The Gantt component supports three types of selection modes that can be set by using the <code>selectionSettings.mode</code> property.
They are:
</p>
<ul>
<li><code>Row</code> - Allows you to select only rows, and the row value is set by default.</li>
<li><code>Cell</code> - Allows you to select only cells.</li>
<li><code>Both</code> - Allows you to select rows and cells at the same time..</li>
</ul>
<p>
The Gantt component supports toggle selection that can be set by using the <code>selectionSettings.enableToggle</code> property.
</p>
</div>
</div>
</template>
<script>
import Vue from "vue";
import { GanttPlugin, Selection } from "@syncfusion/ej2-vue-gantt";
import { projectNewData } from './data-source';
import { DropDownListPlugin, DropDownListComponent } from "@syncfusion/ej2-vue-dropdowns";
import { ButtonPlugin, ClickEventArgs} from "@syncfusion/ej2-vue-buttons";
Vue.use(GanttPlugin);
Vue.use(DropDownListPlugin);
Vue.use(ButtonPlugin);
export default Vue.extend({
data: function() {
return{
data: projectNewData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
child: 'subtasks'
},
labelSettings: {
leftLabel: 'TaskName'
},
splitterSettings: {
columnIndex: 2
},
selectionSettings: {
mode: 'Row',
type: 'Single',
enableToggle: false
},
projectStartDate: new Date('03/27/2019'),
projectEndDate: new Date('07/06/2019'),
selectionModeData: [
{ id: 'Row', type: 'Row' },
{ id: 'Cell', type: 'Cell' }
],
selectionModeFields: {
text: 'type', value: 'id'
},
selectionTypeData: [
{ id: 'Single', type: 'Single' },
{ id: 'Multiple', type: 'Multiple' }
],
selectionTypeFields: {
text: 'type', value: 'id'
},
selectionToggleData: [
{ id: true, type: 'Enable' },
{ id: false, type: 'Disable' }
],
selectionToggleFields: {
text: 'type', value: 'id'
},
toggleValue: false
};
},
provide: {
gantt: [Selection]
},
methods: {
perform: function(ClickEventArgs) {
let mode = this.$refs.selectionmode.ej2Instances.value;
let type = this.$refs.selectiontype.ej2Instances.value;
let toggle = this.$refs.toggle.ej2Instances.value;
this.$refs.gantt.ej2Instances.selectionSettings.mode = mode;
this.$refs.gantt.ej2Instances.selectionSettings.type = type;
this.$refs.gantt.ej2Instances.selectionSettings.enableToggle = toggle;
},
}
});
</script>