You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
depot_django/staticfiles_orig/js/container-details.js

23 lines
836 B
JavaScript

document.addEventListener('DOMContentLoaded', function() {
const table = document.getElementById('objectTable');
if (!table) return;
table.addEventListener('click', function(e) {
const row = e.target.closest('.selectable-row');
if (!row) return;
// Remove selection from all rows
table.querySelectorAll('.selected-row').forEach(selectedRow => {
selectedRow.classList.remove('selected-row');
});
// Add selection to clicked row
row.classList.add('selected-row');
// Get container ID and redirect to show its details
const containerId = row.dataset.id;
const currentUrl = new URL(window.location.href);
currentUrl.searchParams.set('selected', containerId);
window.location.href = currentUrl.toString();
});
});