datatables.html 2.6 KB

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