Merge pull request #816 from hargata/Hargata/refine.sort
only add the default sorter once.
This commit is contained in:
@@ -279,9 +279,11 @@ function sortGarage(sender, isMobile) {
|
||||
sender.addClass('sort-asc');
|
||||
sender.html(isMobile ? `<span class="ms-2 display-3">${garageIcon}${sortColumn}${sortAscIcon}</span>` : `${garageIcon}${sortColumn}${sortAscIcon}`);
|
||||
//append sortRowId to the vehicle container
|
||||
$(`.garage-item`).map((index, elem) => {
|
||||
$(elem).attr("default-sort", index);
|
||||
});
|
||||
if ($("[default-sort]").length == 0) {
|
||||
$(`.garage-item`).map((index, elem) => {
|
||||
$(elem).attr("default-sort", index);
|
||||
});
|
||||
}
|
||||
sortVehicles(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,10 +446,12 @@ function toggleSort(tabName, sender) {
|
||||
}
|
||||
sender.addClass('sort-asc');
|
||||
sender.html(`${sortColumn}${sortAscIcon}`);
|
||||
//append sortRowId to the table rows.
|
||||
$(`#${tabName} table tbody tr`).map((index, elem) => {
|
||||
$(elem).attr("default-sort", index);
|
||||
});
|
||||
//append sortRowId to the table rows if nothing has been appended yet.
|
||||
if ($("[default-sort]").length == 0) {
|
||||
$(`#${tabName} table tbody tr`).map((index, elem) => {
|
||||
$(elem).attr("default-sort", index);
|
||||
});
|
||||
}
|
||||
sortTable(tabName, sortColumn, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user