-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomer_table.php
93 lines (84 loc) · 3.16 KB
/
customer_table.php
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
<html>
<head>
<!-- <link rel="stylesheet" type="text/css" href="/tabulator/dist/css/tabulator.min.css"> -->
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/tabulator-tables@4.9.3/dist/css/tabulator.min.css">
</head>
<body style="margin: 15px auto; width: 100%;position:relative;">
<div id="example-table"></div>
<!-- <script type="text/javascript" src="/tabulator/dist/js/tabulator.min.js"></script> -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/tabulator-tables@4.9.3/dist/js/tabulator.min.js"></script>
<!--<script type="text/javascript" src="/tabulator/moment.js"></script> -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/moment@2.29.4/moment.min.js"></script>
<script>
function changetimestamp2date(value, data, type, cell) {
return new Date(value * 1000);
}
//Build Tabulator
var table = new Tabulator("#example-table", {
height: false,
width: 610,
layout: "fitColumns",
selectable: 1,
pagination: "local", //enable local pagination.
paginationSize: 5, // this option can take any positive integer value (default = 10)
clipboard: true,
clipboardCopyStyled: false,
clipboardCopyHeader: false, //disable header titles in copied data
//paginationSize:20,
placeholder: "No Data Set",
columns: [{
title: "ID",
field: "id",
sorter: "string",
width: 150
},
{
title: "Name",
field: "name",
sorter: "string",
width: 120
},
{
title: "Created",
field: "created",
sorter: "date",
mutator: changetimestamp2date,
align: "center",
width: 190
},
{
title: "Brand",
field: "brand",
sorter: "string",
width: 40
},
{
title: "Country",
field: "country",
sorter: "string",
width: 40
},
{
title: "Last 4 digit",
field: "last4",
width: 70
}
],
ajaxResponse: function(url, params, response) {
return response.reverse();
},
rowSelectionChanged: function(data, rows) {
if (data.length) console.log(data[0].id);
},
});
var ajaxConfig = {
method: "post", //set request type to Position
headers: {
"Content-type": 'application/json; charset=utf-8', //set specific content type
},
};
table.setData("customers.json", {}, ajaxConfig); //make ajax request with advanced config options
</script>
</body>
</html>
<?php