-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
81 lines (77 loc) · 2.46 KB
/
Copy pathindex.html
File metadata and controls
81 lines (77 loc) · 2.46 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Table — NoJS Elements E2E</title>
<style>
*, *::before, *::after { box-sizing: border-box; }
body { font-family: sans-serif; margin: 2rem; color: #333; }
section { margin-bottom: 2rem; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ddd; padding: 0.5rem; text-align: left; }
th[data-sortable] { cursor: pointer; user-select: none; }
</style>
</head>
<body>
<!-- Basic Sortable Table -->
<section>
<div state="{ users: [
{ name: 'Alice', age: 30, email: 'alice@example.com' },
{ name: 'Bob', age: 25, email: 'bob@example.com' },
{ name: 'Charlie', age: 35, email: 'charlie@example.com' },
{ name: 'Diana', age: 28, email: 'diana@example.com' },
{ name: 'Eve', age: 22, email: 'eve@example.com' }
] }">
<table sortable data-test="basic-table">
<thead>
<tr>
<th sort="name" data-test="sort-name">Name</th>
<th sort="age" sort-type="number" data-test="sort-age">Age</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr each="user in users" else="noUsersTpl">
<td bind="user.name"></td>
<td bind="user.age"></td>
<td bind="user.email"></td>
</tr>
</tbody>
</table>
</div>
</section>
<!-- Default Sort Table -->
<section>
<div state="{ people: [
{ name: 'Zara', age: 29 },
{ name: 'Mike', age: 33 },
{ name: 'Anna', age: 21 },
{ name: 'Leo', age: 45 }
] }">
<table sortable data-test="default-sort-table">
<thead>
<tr>
<th sort="name" sort-default="asc">Name</th>
<th sort="age" sort-type="number">Age</th>
</tr>
</thead>
<tbody>
<tr each="person in people" else="noDataTpl">
<td bind="person.name"></td>
<td bind="person.age"></td>
</tr>
</tbody>
</table>
</div>
</section>
<template id="noUsersTpl"><tr><td colspan="3">No users found</td></tr></template>
<template id="noDataTpl"><tr><td colspan="2">No data</td></tr></template>
<script src="../../../NoJS/dist/iife/no.js"></script>
<script src="../../../dist/iife/nojs-elements.js"></script>
<script>
NoJS.use(NoJSElements);
NoJS.init();
</script>
</body>
</html>