Fix row checkbox selection behavior in Tabulator

This commit is contained in:
Mikhail Chusavitin
2026-02-04 17:13:09 +03:00
parent 9dfef30ad7
commit 8ee8847600

View File

@@ -243,32 +243,8 @@ async function selectTable(schema, tableName, restoreState = false) {
// Формируем колонки
const columns = [
{
formatter: function(cell, formatterParams, onRendered) {
const row = cell.getRow();
const checkbox = document.createElement("input");
checkbox.type = "checkbox";
checkbox.checked = row.isSelected();
checkbox.style.cursor = "pointer";
checkbox.style.width = "16px";
checkbox.style.height = "16px";
return checkbox;
},
titleFormatter: function(cell, formatterParams, onRendered) {
const checkbox = document.createElement("input");
checkbox.type = "checkbox";
checkbox.style.cursor = "pointer";
checkbox.style.width = "16px";
checkbox.style.height = "16px";
checkbox.addEventListener("click", function(e) {
e.stopPropagation();
if (checkbox.checked) {
table.getRows().forEach(row => row.select());
} else {
table.deselectRow();
}
});
return checkbox;
},
formatter: "rowSelection",
titleFormatter: "rowSelection",
hozAlign: "center",
headerHozAlign: "center",
headerSort: false,
@@ -279,15 +255,7 @@ async function selectTable(schema, tableName, restoreState = false) {
frozen: true,
cellClick: function(e, cell) {
e.stopPropagation();
const row = cell.getRow();
const checkbox = cell.getElement().querySelector('input[type="checkbox"]');
if (row.isSelected()) {
row.deselect();
if (checkbox) checkbox.checked = false;
} else {
row.select();
if (checkbox) checkbox.checked = true;
}
cell.getRow().toggleSelect();
}
},
...currentMeta.columns.map(col => {