Skip to content

Instantly share code, notes, and snippets.

@nikcorg
Last active November 24, 2015 15:43
Show Gist options
  • Save nikcorg/6ad48cc1c3d84d98d384 to your computer and use it in GitHub Desktop.
Save nikcorg/6ad48cc1c3d84d98d384 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>TableSort Demo</title>
<body>
<table>
<thead>
<tr>
<th class="default-sort">Weekday</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>Monday</td>
<td data-sort="11-23-2015">23.11.2015</td>
</tr>
<tr>
<td>Tuesday</td>
<td data-sort="11-24-2015">24.11.2015</td>
</tr>
<tr>
<td>Thursday</td>
<td data-sort="11-26-2015">26.11.2015</td>
</tr>
<tr>
<td>Friday</td>
<td data-sort="11-27-2015">27.11.2015</td>
</tr>
<tr>
<td>Wednesday</td>
<td data-sort="11-25-2015">25.11.2015</td>
</tr>
</tbody>
</table>
<script async defer src="./bundle.js"></script>
</body>
</html>
var Tablesort = require("tablesort");
// Just the require needed, as the sort-method extends the Tablesort prototype
require("./sorts/tablesort.date.js");
var table = document.querySelector("table");
var sort = new Tablesort(table);
{
"scripts": {
"build": "browserify index.js > bundle.js"
},
"browserify-shim": {
"./sorts/tablesort.date.js": {
"depends": "tablesort:Tablesort"
}
},
"browserify": {
"transform": ["browserify-shim"]
},
"dependencies": {
"tablesort": "*",
"browserify": "*",
"browserify-shim": "*"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment