How to make a Table have the effect of dynamic sorting, in most cases, we will pass the sorting information in the foreground to the background to Order; So is it possible to sort directly according to the existing data without going through background processing? The answer is yes. Today, I found a powerful Js library that can dynamically sort tables and share them with you. The steps are as follows:
1. Download the js library;
2. Refer to the page header
<script src="sorttable.js"></script>
3. Add table class
<table class="sortable">
If you want to control the style of the sorting button, you can add the following css style
/* Sortable tables */ table.sortable thead { background-color:#eee; color:#666666; font-weight: bold; cursor: default; }
Attachment: JS library