-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapi.html
108 lines (102 loc) · 4.54 KB
/
api.html
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
<!DOCTYPE html>
<html>
<head>
<title>JSTable</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="./css/jstable.css" />
<link rel="stylesheet" type="text/css" href="./css/style.css" />
</head>
<body class="jstable">
<header id="masthead" class="site-header">
<div class="header-inner">
<div class="header-left">
<p class="site-description"><a href="./index.html">JSTable</a></p>
</div>
<div id="mobile-header-icons">
<button id="menu-toggle" class="menu-toggle" aria-controls="menu-primary" aria-expanded="false">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</button>
</div>
<nav id="site-navigation" class="main-navigation" role="navigation">
<ul id="menu-primary" class="menu nav-menu">
<li><a href="./basics.html">Basics</a></li>
<li><a href="./options.html">Options</a></li>
<li><a href="./events.html">Events</a></li>
<li class="active"><a href="./api.html">API</a></li>
</ul>
</nav>
</div>
</header>
<div id="content" class="site-content container">
<div class="inner-content">
<div class="page-header">
<h2>API</h2>
</div>
<div class="page-content">
<div class="option-description">
<h3><code>paginate(new_page)</code></h3>
<p>change to <code>new_page</code></p>
</div>
<pre>
let mytable = new JSTable('#table');
mytable.paginate(5);
</pre>
<div class="option-description">
<h3><code>search(query)</code></h3>
<p>search for <code>query</code></p>
</div>
<pre>
let mytable = new JSTable('#table');
mytable.search("Denmark");
</pre>
<p>You could update the search input by addressing the CSS selector defined in the config:</p>
<pre>
let searchfield = document.querySelector('.dt-input');
// or alternatively:
// let searchfield = document.querySelector('.'+table.config.classes.input);
searchfield.value = 'Denmark';
</pre>
<div class="option-description">
<h3><code>sort(column, direction, initial = false)</code></h3>
<div class="options"><code>column</code>: Index of column to sort<br/>
<code>direction</code>: Sorting direction, either <code>asc</code> or <code>desc</code><br/>
<code>initial</code>: is this the initial sorting
</div>
<p>change the sorting of the table</code></p>
</div>
<pre>
let mytable = new JSTable('#table');
myTable.sort(0, 'asc');
</pre>
<div class="option-description">
<h3>Change elements per page</h3>
</div>
<p>To change the elements per page, you need to modify the select element and update the table:</p>
<pre>
let select = document.querySelector('.dt-selector');
// or alternatively:
// let select = document.querySelector('.'+table.config.classes.selector);
select.value = 10;
table.update();
</pre>
</div>
</div>
</div>
<footer class="site-footer">
<div class="footer-inner">
<ul>
<li><a href="https://www.haegi.org/impressum/">Impressum</a></li>
<li><a href="https://www.haegi.org/datenschutz/">Datenschutz</a></li>
</ul>
</div>
</footer>
<script src="./js/polyfill-fetch.min.js" type="text/javascript"></script>
<script src="./js/jstable.es5.min.js" type="text/javascript"></script>
<script src="./js/main.js" type="text/javascript"></script>
<script src="./js/table.js" type="text/javascript"></script>
</body>
</html>