Код: Выделить всё
RangeError: Invalid time value
at Date.toISOString ()
Код: Выделить всё
.then((json) => {
const rows =
(Array.isArray(json) && json) ||
json.data ||
json.rows ||
(json.data && Array.isArray(json.data.data) && json.data.data) ||
[];
const thead = document.querySelector("#positionsTable thead tr");
if ($.fn.DataTable && $.fn.DataTable.isDataTable("#positionsTable")) {
$("#positionsTable").DataTable().clear().destroy();
}
if (thead) thead.innerHTML = "";
if (!rows.length) {
if (thead) thead.innerHTML = "No positions";
return;
}
const columns = Object.keys(rows[0]);
console.log("columns:", columns);
columns.forEach((col) => {
if (col === "id") return;
const th = document.createElement("th");
th.textContent = col;
thead.appendChild(th);
});
if ($.fn.dataTable) $.fn.dataTable.ext.errMode = "throw";
console.log("Sample row:", rows[0]);
$("#positionsTable").DataTable({
destroy: true,
processing: true,
data: rows,
columns: columns,
});
})
Я попытался преобразовать поле идентификатора в строку, однако у меня все же были те же результаты.
Подробнее здесь: https://stackoverflow.com/questions/797 ... e-value-er
Мобильная версия