Differentiate between no sort and no sort-and-filter in tables
This commit is contained in:
parent
5d6b373769
commit
56c1a46b37
@ -1,11 +1,16 @@
|
||||
class BrickTable {
|
||||
constructor(table, per_page) {
|
||||
const columns = []
|
||||
const columns = [];
|
||||
const no_sort_and_filter = [];
|
||||
const no_sort = [];
|
||||
const number = [];
|
||||
|
||||
// Read the table header for parameters
|
||||
table.querySelectorAll('th').forEach((th, index) => {
|
||||
if (th.dataset.tableNoSortAndFilter) {
|
||||
no_sort_and_filter.push(index);
|
||||
}
|
||||
|
||||
if (th.dataset.tableNoSort) {
|
||||
no_sort.push(index);
|
||||
}
|
||||
@ -15,8 +20,12 @@ class BrickTable {
|
||||
}
|
||||
});
|
||||
|
||||
if (no_sort_and_filter.length) {
|
||||
columns.push({ select: no_sort_and_filter, sortable: false, searchable: false });
|
||||
}
|
||||
|
||||
if (no_sort.length) {
|
||||
columns.push({ select: no_sort, sortable: false, searchable: false });
|
||||
columns.push({ select: no_sort, sortable: false });
|
||||
}
|
||||
|
||||
if (number.length) {
|
||||
|
@ -6,9 +6,9 @@
|
||||
<tr>
|
||||
<th scope="col"><i class="ri-file-line fw-normal"></i> Filename</th>
|
||||
<th scope="col"><i class="ri-hashtag fw-normal"></i> Set</th>
|
||||
<th data-table-no-sort="true" class="no-sort" scope="col"><i class="ri-image-line fw-normal"></i> Image</th>
|
||||
<th data-table-no-sort-and-search="true" class="no-sort" scope="col"><i class="ri-image-line fw-normal"></i> Image</th>
|
||||
{% if g.login.is_authenticated() %}
|
||||
<th data-table-no-sort="true" class="no-sort" scope="col"><i class="ri-settings-4-line fw-normal"></i> Actions</th>
|
||||
<th data-table-no-sort-and-search="true" class="no-sort" scope="col"><i class="ri-settings-4-line fw-normal"></i> Actions</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
{% if image %}
|
||||
<th data-table-no-sort="true" class="no-sort" scope="col"><i class="ri-image-line fw-normal"></i> Image</th>
|
||||
<th data-table-no-sort-and-search="true" class="no-sort" scope="col"><i class="ri-image-line fw-normal"></i> Image</th>
|
||||
{% endif %}
|
||||
<th scope="col"><i class="ri-pencil-line fw-normal"></i> Name</th>
|
||||
{% if color %}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<table data-table="{% if all %}true{% endif %}" class="table table-striped align-middle" id="wish">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-table-no-sort="true" class="no-sort" scope="col"><i class="ri-image-line fw-normal"></i> Image</th>
|
||||
<th data-table-no-sort-and-search="true" class="no-sort" scope="col"><i class="ri-image-line fw-normal"></i> Image</th>
|
||||
<th scope="col"><i class="ri-hashtag fw-normal"></i> Set</th>
|
||||
<th scope="col"><i class="ri-pencil-line fw-normal"></i> Name</th>
|
||||
<th scope="col"><i class="price-tag-3-line fw-normal"></i> Theme</th>
|
||||
@ -13,7 +13,7 @@
|
||||
<th scope="col"><i class="ri-shapes-line fw-normal"></i> Parts</th>
|
||||
<th scope="col"><i class="ri-calendar-close-line fw-normal"></i> Retirement</th>
|
||||
{% if g.login.is_authenticated() %}
|
||||
<th data-table-no-sort="true" class="no-sort" scope="col"><i class="ri-settings-4-line fw-normal"></i> Actions</th>
|
||||
<th data-table-no-sort-and-search="true" class="no-sort" scope="col"><i class="ri-settings-4-line fw-normal"></i> Actions</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
|
Loading…
Reference in New Issue
Block a user