simple-datatables
Version:
A lightweight, dependency-free JavaScript HTML table plugin.
61 lines (58 loc) • 2.12 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<title>Sort order attribute - simple-datatables</title>
<!-- DataTable Styles -->
<link rel="stylesheet" href="../dist/css/style.css">
<!-- Demo Styles -->
<link rel="stylesheet" href="../demo.css">
</head>
<body>
<header>
<h1>
<a href="../../">simple-datatables</a>
</h1>
<a href="../../documentation">Documentation</a>
<a href="../">Demos</a>
</header>
<h2>Sort order attribute</h2>
<p>Try sorting the two table columns. Then look at the source of the page. The data-order attributes on the cells take precendent over the contents fo the cells.</p>
<table id="reports" class="table t-table-simple table-fix js-dataTable">
<thead>
<tr id="reports_Header">
<th>Name</th>
<th>Variation</th>
</tr>
</thead>
<tbody>
<tr>
<td data-order="B">A</td>
<td data-order="0">2000.9%</td>
</tr>
<tr>
<td data-order="A">B</td>
<td data-order="-0.5">100.3%</td>
</tr>
<tr>
<td data-order="D">C</td>
<td data-order="0.4">20%</td>
</tr>
<tr>
<td data-order="E">D</td>
<td data-order="-0.41">-7%</td>
</tr>
<tr>
<td data-order="C">E</td>
<td data-order="1.6">-9%</td>
</tr>
</tbody>
</table>
<script type="module">
import {DataTable} from "../dist/module.js"
window.dt = new DataTable("#reports", {})
</script>
</body>
</html>