|
@@ -0,0 +1,45 @@
|
|
1
|
+<html>
|
|
2
|
+<head>
|
|
3
|
+<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css"/>
|
|
4
|
+<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.js"></script>
|
|
5
|
+<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
|
|
6
|
+<script>
|
|
7
|
+$(document).ready(function() {
|
|
8
|
+ $('#example').DataTable( {
|
|
9
|
+ ajax: {
|
|
10
|
+ url: '/api.php/records/posts?join=categories&join=users',
|
|
11
|
+ dataSrc: 'records'
|
|
12
|
+ },
|
|
13
|
+ columns: [
|
|
14
|
+ { data: "id" },
|
|
15
|
+ { data: "user_id.username" },
|
|
16
|
+ { data: "category_id.name" },
|
|
17
|
+ { data: "content" }
|
|
18
|
+ ]
|
|
19
|
+ });
|
|
20
|
+});
|
|
21
|
+</script>
|
|
22
|
+</head>
|
|
23
|
+<body>
|
|
24
|
+
|
|
25
|
+<table id="example" class="display" style="width:100%">
|
|
26
|
+ <thead>
|
|
27
|
+ <tr>
|
|
28
|
+ <th>ID</th>
|
|
29
|
+ <th>Username</th>
|
|
30
|
+ <th>Category</th>
|
|
31
|
+ <th>Content</th>
|
|
32
|
+ </tr>
|
|
33
|
+ </thead>
|
|
34
|
+ <tfoot>
|
|
35
|
+ <tr>
|
|
36
|
+ <th>ID</th>
|
|
37
|
+ <th>Username</th>
|
|
38
|
+ <th>Category</th>
|
|
39
|
+ <th>Content</th>
|
|
40
|
+ </tr>
|
|
41
|
+ </tfoot>
|
|
42
|
+</table>
|
|
43
|
+
|
|
44
|
+</body>
|
|
45
|
+</html>
|