-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.html
More file actions
140 lines (128 loc) · 3.79 KB
/
app.html
File metadata and controls
140 lines (128 loc) · 3.79 KB
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
<!doctype html>
<head>
<meta charset="utf-8">
<title> Layout </title>
<script type="text/javascript" src="http://cdn.webix.com/edge/webix_debug.js"></script>
<link rel="stylesheet" type="text/css" href="http://cdn.webix.com/edge/webix.css">
<script type="text/javascript" src="testdata.js"></script>
<style type="text/css">
.grayBackground,.grayBackground .webix_list{
background-color: #F2F2F2;
}
.name{
font-size: 20px;
font-weight:bold;
padding-left:30px;
}
.status{
color: green;
text-align:center;
}
.line{
border-bottom: 1px solid #dedede;
}
</style>
</head>
<body>
<script type="text/javascript" charset="utf-8">
webix.ready(function(){
var top = {
view:"toolbar",
cols:[
{view:"label", css:"name", label:"My App"},
{},
{view:"button", css:"profileButton", type:"icon", icon:"user", label:"Profile", autowidth:true}
]
};
var content = {
view:"layout",
css:"line",
cols:[
{css:"grayBackground", rows:[
{
view:"list",
id:"mylist",
autoheight:true,
scroll:false,
data:[ "Dashboard", "Users", "Products", "Locations" ]
},
{ },
{ view:"label", css:"status", label:"<span class='webix_icon fa-check'></span>connected"}
], gravity: 0.3},
{
view:"datatable",
id: "datatable",
columns:[
{ id:"title", header:"Title", width:280},
{ id:"year", header:"Year", width:100},
{ id:"votes", header:"Votes", width:100},
{ id:"rating", header:"Rating", width:100},
{ id:"rank", header:"Rank", width:100}
],
data:small_film_set
},
{ gravity: 0.7,
view: "form",
id: "form",
elements:[
{view:"template", template:"edit form", type:"section"},
{ view:"text", value:"Title<input>", name:"title", invalidMessage: "Not empty!", label:"Title"},
{ view:"text", value:"2017",name:"year", invalidMessage: "Enter year between 1970 and "+(new Date()).getFullYear(), label:"Year"},
{ view:"text", value:"5",name:"rating",invalidMessage: "number, greater than 0", label:"Rating"},
{ view:"text",value:"25", name:"votes",invalidMessage: "Must be less than 100000", label:"Votes"},
{ cols:[
{view:"button", value:"Add new", type:"form",
click: function() {
if ($$("form").validate()) {
//как-то так с элементами .innerHTML = "";
var item = $$("form").getValues();
$$("datatable").add(item);
webix.message("Data entered correctly");
}
}
},
{view:"button", value:"Clear",click: function() {
var titleInput = $$("form").elements.title;
titleInput.setValue("");
$$("form").clear();
$$("form").clearValidation();
}
}
]},
{}
],
rules:{
title: webix.rules.isNotEmpty,
year: function(value) {
return value > 1970 && value <= (new Date()).getFullYear();
},
votes: webix.rules.isNotEmpty,
votes: function(value) {
return value > 0 && value < 100000;
},
rating: webix.rules.isNotEmpty,
rating: function(value) {
return value > 0;
}
},
on:{
onValidationError: function(key, data) {
webix.message({
text: key + " field is incorrect",
type: "error"
});
}
}
}
]
};
var bottom = {
view:"label", align:"center", label:"The software is provided by <a href='https://webix.com/'>https://webix.com/</a>. All rights reserved ©."
};
webix.ui({
rows:[top,content,bottom]
});
});
</script>
</body>
</html>