- Your task:
Display JSON-data in the browser in a table which is sortable by the user. - Solution:
Install JCI-Plugin and the plugin “Table Sorter“ - Example-Code:
[jsoncontentimporterpro url=https://api.blockchain.info/charts/transactions-per-second?timespan=5weeks&rollingAverage=8hours&format=json method=rawget parser=twig] {{description}} <table id=”myTable” class=”tablesorter”>
<thead><tr>
<th>no (sortable)</th>
<th class=”sortless”>x</th>
<th>x (sortable)</th>
<th>y (sortable)</th>
<th>randomno (sortable) </tr></thead>
<tbody>
{%for v in values %}
{% if loop.index<10 %}
<tr><td>{{loop.index}}</td><td>{{v.x}}</td><td>{{v.x}}</td><td>{{v.y}}</td><td>
{{ random(5000) }} </td></tr>
{% endif %}
{% endfor %}
</tbody></table>
[/jsoncontentimporterpro]
The number of Bitcoin transactions added to the mempool per second.
no (sortable) | x | x (sortable) | y (sortable) | randomno (sortable) |
---|---|---|---|---|
1 | 1572899580 | 1572899580 | 4.01065972222 | 4624 |
2 | 1572901620 | 1572901620 | 4.00340277778 | 1497 |
3 | 1572903660 | 1572903660 | 3.89909722222 | 2881 |
4 | 1572905700 | 1572905700 | 3.86340277778 | 1416 |
5 | 1572907740 | 1572907740 | 3.80503472222 | 4951 |
6 | 1572909780 | 1572909780 | 3.70479166667 | 4741 |
7 | 1572911820 | 1572911820 | 3.70857638889 | 1692 |
8 | 1572913860 | 1572913860 | 3.66427083333 | 754 |
9 | 1572915900 | 1572915900 | 3.61625 | 2395 |
Credits: Thank you Lawrence from South Melbourne, Australia