Combo-box partidas
This commit is contained in:
@@ -265,12 +265,24 @@
|
||||
<td><button type="button" class="btn btn-danger btn-sm remove-row">✖️</button></td>
|
||||
`;
|
||||
tbody.appendChild(row);
|
||||
// re-init Choices on new selects
|
||||
// Re-inicializar Choices.js en los nuevos selects
|
||||
row.querySelectorAll('.searchable').forEach(el => {
|
||||
new Choices(el, { searchEnabled: true, itemSelectText: '', shouldSort: false });
|
||||
});
|
||||
});
|
||||
|
||||
// Manejador para controlar el overflow al abrir dropdowns
|
||||
document.addEventListener('click', function(e) {
|
||||
const tableContainer = document.querySelector('.table-responsive');
|
||||
if (!tableContainer) return;
|
||||
|
||||
if (e.target.closest('.choices__inner')) {
|
||||
tableContainer.style.overflow = 'visible';
|
||||
} else {
|
||||
tableContainer.style.overflow = 'auto';
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector('#tabla-partidas tbody').addEventListener('click', e => {
|
||||
if (e.target.matches('.remove-row')) e.target.closest('tr').remove();
|
||||
});
|
||||
@@ -317,4 +329,4 @@
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
Reference in New Issue
Block a user