forked from syncfusion/ej2-vue-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvirtual-scroll.vue
71 lines (69 loc) · 2.36 KB
/
virtual-scroll.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
<template>
<div>
<div class="control-section">
<div class="content-wrapper">
<ejs-gantt ref='gantt' id="virtualscroll"
:dataSource= "data"
:taskFields= "taskFields"
:allowSelection= "true"
:enableVirtualization= "true"
:labelSettings= "labelSettings"
:height= "height"
:treeColumnIndex= "1"
:highlightWeekends= "true"
:columns= "columns"
:splitterSettings= "splitterSettings">
</ejs-gantt>
</div>
</div>
<div id="action-description">
<p>This sample demonstrates the Virtual Scroll support in the Gantt Chart. This feature allows users to load a large amount of data effectively.
It also reduces the DOM element's weight by virtually updating DOM during the vertical scroll.</p>
</div>
<div id="description">
<p>Virtualization support is used to render large number tasks in Gantt with effective performance. In this mode all the tasks are
fetched from data source initially, then some of the records are rendered in DOM which are compact to the current viewport area.
While scrolling tasks are updated in DOM as per current viewport position. This mode can be enabled by setting
<code>enableVirtualization</code> property as true. </p>
</div>
</div>
</template>
<script>
import Vue from "vue";
import { GanttPlugin, Selection, VirtualScroll } from "@syncfusion/ej2-vue-gantt";
import { virtualData } from './data-source';
Vue.use(GanttPlugin);
export default Vue.extend({
data: function() {
return{
data: virtualData,
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'parentID'
},
columns: [
{ field: 'TaskID' },
{ field: 'TaskName' },
{ field: 'StartDate' },
{ field: 'Duration' },
{ field: 'Progress' }
],
height: '450px',
labelSettings: {
taskLabel: 'Progress'
},
splitterSettings: {
columnIndex: 2
}
};
},
provide: {
gantt: [ Selection, VirtualScroll]
}
});
</script>