/
datatable.js
64 lines (56 loc) · 1.25 KB
/
datatable.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
import {JetApp, JetView} from "webix-jet";
class SubLayout extends JetView {
constructor(app, name, data){
super(app, name);
this.customData = data;
}
config(){
return {
rows:[
{ type:"header", template: () => this.customData.title },
SubTemplate
]
}
}
}
class SubTemplate extends JetView {
config(){
return {
template:"Subview", height: 30
};
}
}
class TopView extends JetView {
config(){
return {
view:"datatable",
subview: (obj, target) => {
//will work only for sync JetViews
var sub = new SubLayout(this.app, "", {
title: obj.title
});
this.ui(sub, { container: target });
return sub.getRoot();
},
columns:[
{ id:"title", header:"Title", sort:"string",
template:"{common.subrow()} #title#", width:220 },
{ id:"year", header:"Year", width:100, sort:"int"},
{ id:"votes", header:"Votes", width:100, sort:"int"}
],
data:[
{ id:1, title:"The Shawshank Redemption", year:1994, votes:678790 },
{ id:2, title:"The Godfather", year:1972, votes:511495 },
{ id:3, title:"The Godfather: Part II", year:1974, votes:319352 }
]
};
}
}
const app = new JetApp({
id: "windows",
start: "/top",
views:{
top: TopView
}
});
export default app;