-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
250 lines (245 loc) · 9.62 KB
/
index.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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SortableRows - Drag and Sort Items</title>
<link rel="icon" href="images/favicon.svg" sizes="any" type="image/svg+xml">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Z1ZZ81T58F"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-Z1ZZ81T58F');
</script>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
integrity="sha512-9usAa10IRO0HhonpyAIVpjrylPvoDwiPUiKdWk5t3PyolY1cOd4DSE0Ga+ri4AuTroPR5aQvXU9xC6qOPnzFeg=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3"
crossorigin="anonymous"
/>
<link rel="stylesheet" href="./dist/sortablerows.css" />
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<div class="container-fluid">
<span class="navbar-brand mb-0 h1"><i class="fas fa-arrow-down-short-wide"></i> SortableRows</span>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarCollapse"
aria-controls="navbarCollapse"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav me-auto mb-2 mb-md-0">
<li class="nav-item">
<a href="https://davidticona.com" class="nav-link active" aria-current="page">Home</a>
</li>
<li class="nav-item">
<a href="https://www.linkedin.com/in/david-ticona-saravia/" class="nav-link"
><i class="fab fa-linkedin"></i> LinkedIn</a
>
</li>
</ul>
<div class="d-flex">
<a class="btn btn-success" href="https://github.com/davicotico/SortableRows" target="_blank"><i class="fab fa-github"></i> View on Github</a>
</div>
</div>
</div>
</nav>
<div
class="px-4 py-5 my-5 text-center border-bottom border-3 bg-secondary bg-opacity-10"
>
<h1 class="display-5 fw-bold">SortableRows v1.1.1</h1>
<h4>by Davicotico</h4>
<div class="col-lg-6 mx-auto">
<p class="lead mb-4">
Drag and Sort your items with <strong>THIS</strong> Sortable Table
Rows<br>
Made with <strong>TypeScript</strong>
</p>
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
<div class="btn-group">
<a
href="https://github.com/davicotico/SortableRows/stargazers"
class="btn btn-light border-secondary"
target="_blank"
role="button"
><i class="fas fa-star"></i></a>
<a
id="btnStars"
href="https://github.com/davicotico/SortableRows/stargazers"
class="btn bg-white border-secondary"
target="_blank"
role="button"
></a>
</div>
<div class="btn-group">
<a
href="https://github.com/davicotico/SortableRows/fork"
class="btn btn-light border-secondary"
target="_blank"
role="button"
>
<i class="fas fa-code-branch"></i> Forks
</a>
<a
id="btnForks"
href="https://github.com/davicotico/SortableRows/network/members"
class="btn bg-white border-secondary"
target="_blank"
role="button"
></a>
</div>
<a href="https://github.com/davicotico/SortableRows" class="btn btn-success px-4 gap-3">
<i class="fab fa-github"></i> View on Github
</a>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col">
<h3>Demo</h3>
<p>Sort the rows by drag & drop, then click the Output button.</p>
<table id="myTable" class="table table-bordered">
<thead class="table-light">
<tr>
<th>Company ID</th>
<th>Company name</th>
</tr>
</thead>
<tbody>
<tr data-company-id="1" data-company-name="Huawei">
<td>1</td>
<td>Huawei</td>
</tr>
<tr data-company-id="2" data-company-name="Xiaomi">
<td>2</td>
<td>Xiaomi</td>
</tr>
<tr data-company-id="3" data-company-name="TikTok">
<td>3</td>
<td>TikTok</td>
</tr>
<tr data-company-id="4" data-company-name="Yandex">
<td>4</td>
<td>Yandex</td>
</tr>
</tbody>
</table>
<button id="btnOutput" class="btn btn-success">
<i class="fas fa-check-square"></i> Output
</button>
<textarea id="txtOutput" class="form-control my-3" rows="10"></textarea>
</div>
<div class="col">
<h3>Install</h3>
<pre class="bg-secondary text-white p-1 border">
npm install sortablerows</pre
>
<h3>How to use</h3>
<h4>Html Table</h4>
<p>Use the table with an <code>id</code> attribute</p>
<pre class="p-2 bg-light border">
<table id="myTable">
</table></pre>
<p>Use the <code>data</code> attribute for each row</p>
<pre class="p-2 bg-light border">
<tbody>
<tr data-company-id="1" data-company-name="Huawei">
<td>1</td>
<td>Huawei</td>
</tr>
<tr data-company-id="2" data-company-name="Xiaomi">
<td>2</td>
<td>Xiaomi</td>
</tr>
<tr data-company-id="3" data-company-name="TikTok">
<td>3</td>
<td>TikTok</td>
</tr>
<tr data-company-id="4" data-company-name="Yandex">
<td>4</td>
<td>Yandex</td>
</tr>
</tbody></pre>
<h4>Javascript</h4>
<p>Import the class, import the CSS file and instantiate the class</p>
<pre class="p-2 bg-light border">
import { SortableRows } from "sortablerows";
import "sortablerows/dist/sortablerows.css";
var myTable = new SortableRows("myTable");
</pre>
<p>Get the sorted items by calling <code>getData()</code></p>
<pre class="p-2 bg-light border">
document.getElementById("btnOutput").addEventListener("click", () => {
let output = myTable.getData();
console.log(output);
});
</pre>
<h3>More projects</h3>
<div class="list-group">
<a href="https://github.com/davicotico/jQuery-Menu-Editor" class="list-group-item list-group-item-action">jQuery Menu Editor</a>
<a href="https://github.com/davicotico/jQuery-Menu-From-JSON" class="list-group-item list-group-item-action">jQuery Menu from JSON</a>
<a href="https://github.com/davicotico/PHP-Quick-Menu" class="list-group-item list-group-item-action">PHP Quick Menu</a>
<a href="https://github.com/davicotico/jQuery-formHelper" class="list-group-item list-group-item-action">jQuery formHelper</a>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col">
<h3>Changelog</h3>
<h5>v1.1.1</h5>
<ul>
<li>Debug message removed</li>
</ul>
<h5>v1.1.0</h5>
<ul>
<li>Added minified version dist/sortablerows.min.js</li>
</ul>
<h5>v1.0.0</h5>
<ul>
<li>First release on npmjs.com</li>
</ul>
</div>
</div>
</div>
<footer class="text-center text-dark bg-light border-top">
<div class="text-center p-3">
<strong>
2022 · <a href="https://davidticona.com/">davidticona.com</a> ·
<a href="https://twitter.com/davicotico" target="_blank">@davicotico <i class="fab fa-twitter"></i></a>
</strong>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script>
<script src="./dist/sortablerows.min.js"></script>
<script>
var myTable = new SortableRows("myTable");
document.getElementById("btnOutput").addEventListener("click", () => {
let output = myTable.getData();
document.getElementById("txtOutput").innerHTML = JSON.stringify(output, null, 2);
});
fetch( "https://api.github.com/repos/davicotico/SortableRows").then(response => response.json())
.then( data => {
document.getElementById("btnStars").innerHTML = data.stargazers_count;
document.getElementById("btnForks").innerHTML = data.forks_count;
});
</script>
</body>
</html>