re-render when children's checkbox toggles
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
f282b10c05
commit
e8c3da4ac8
@ -9,21 +9,28 @@ function init() {
|
|||||||
.then((books) => {
|
.then((books) => {
|
||||||
// prepare response
|
// prepare response
|
||||||
books.forEach(apiResponseParsing);
|
books.forEach(apiResponseParsing);
|
||||||
document.getElementById("search").addEventListener("input", (e) => {
|
document
|
||||||
renderTable(
|
.getElementById("search")
|
||||||
search(
|
.addEventListener("input", triggerUpdate);
|
||||||
books,
|
document
|
||||||
e.target.value,
|
.getElementById("childrens")
|
||||||
document.getElementById("childrens").checked
|
.addEventListener("change", triggerUpdate);
|
||||||
)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
renderTable(
|
renderTable(
|
||||||
search(books, "", document.getElementById("childrens").checked)
|
search(books, "", document.getElementById("childrens").checked)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function triggerUpdate() {
|
||||||
|
renderTable(
|
||||||
|
search(
|
||||||
|
books,
|
||||||
|
document.getElementById("search").value,
|
||||||
|
document.getElementById("childrens").checked
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function renderTable(books, sortField) {
|
function renderTable(books, sortField) {
|
||||||
if (sortField) {
|
if (sortField) {
|
||||||
if (sortState.sortBy === sortField && sortState.sortOrder === "asc") {
|
if (sortState.sortBy === sortField && sortState.sortOrder === "asc") {
|
||||||
|
Loading…
Reference in New Issue
Block a user