datatables.html 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ---
  2. title: Datatables
  3. page-header: Datatables
  4. page-libs: [lists]
  5. page-menu: base.datatables
  6. layout: default
  7. permalink: datatables.html
  8. ---
  9. {% assign id = include.map-id | default: 'default' %}
  10. <div class="card">
  11. <div class="card-body p-0">
  12. {% assign products = 'Tabler,Tabler Icons,Tabler Emails,Tabler Components,Tabler Illustrations,Bootstrap' | split: ',' %}
  13. {% assign techs = 'brand-apple,brand-windows,brand-debian,brand-android' | split: ',' %}
  14. <div id="table-{{ id }}" class="table-responsive">
  15. <table class="table">
  16. <thead>
  17. <tr>
  18. <th><button class="table-sort" data-sort="sort-name">Name</button></th>
  19. <th><button class="table-sort" data-sort="sort-city">City</button></th>
  20. <th><button class="table-sort" data-sort="sort-type">Type</button></th>
  21. <th><button class="table-sort" data-sort="sort-score">Score</button></th>
  22. <th><button class="table-sort" data-sort="sort-date">Date</button></th>
  23. <th><button class="table-sort" data-sort="sort-quantity">Quantity</button></th>
  24. <th><button class="table-sort" data-sort="sort-progress">Progress</button></th>
  25. </tr>
  26. </thead>
  27. <tbody class="table-tbody">
  28. {% for rc in rollercoasters %}
  29. {% assign progress = forloop.index | random_number %}
  30. <tr>
  31. <td class="sort-name">{{ rc.name }}</td>
  32. <td class="sort-city">{{ rc.city }}</td>
  33. <td class="sort-type">{{ rc.type }}</td>
  34. <td class="sort-score">{{ rc.score }}</td>
  35. <td class="sort-date" data-date="{{ forloop.index | random_date: site.randomDateFrom, site.randomDateTo | date: '%s' }}">{{ forloop.index | random_date: site.randomDateFrom, site.randomDateTo | date: '%B %d, %Y' }}</td>
  36. <td class="sort-quantity">{{ forloop.index | random_number: 1, 200 }}</td>
  37. <td class="sort-progress" data-progress="{{ progress }}">
  38. <div class="row align-items-center">
  39. <div class="col-12 col-lg-auto">{{ progress }}%</div>
  40. <div class="col">{% include "ui/progress.html" value=progress width="5rem" %}</div>
  41. </div>
  42. </td>
  43. </tr>
  44. {% endfor %}
  45. </tbody>
  46. </table>
  47. </div>
  48. </div>
  49. </div>
  50. {% capture_global scripts %}
  51. <script>
  52. {% if environment == 'development' %}window.tabler_list = window.tabler_list || {};{% endif %}
  53. document.addEventListener("DOMContentLoaded", function() {
  54. const list = {% if environment == 'development' %}window.tabler_list["table-{{ id }}"] = {% endif %}new List('table-{{ id }}', {
  55. sortClass: 'table-sort',
  56. listClass: 'table-tbody',
  57. valueNames: [ 'sort-name', 'sort-type', 'sort-city', 'sort-score',
  58. { attr: 'data-date', name: 'sort-date' },
  59. { attr: 'data-progress', name: 'sort-progress' },
  60. 'sort-quantity'
  61. ]
  62. });
  63. })
  64. </script>
  65. {% endcapture_global %}