Skip to content

Commit

Permalink
add node rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico Bakomihalis committed Oct 25, 2024
1 parent 2ca0e66 commit c95d556
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion node-parents-children/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@ function initGrist(){
grist.ready({ requiredAccess: 'read table', columns: ["node", "children", "parents"] });
grist.onRecord(function (record) {
console.log("record", record);
const mapped = grist.mapColumnNames(record);
// First check if all columns were mapped.
if (mapped) {
renderPage(mapped);
} else {
// Helper returned a null value. It means that not all
// required columns were mapped.
console.error("Please map all columns");
}
});

}

function renderPage(mapped){
const node = mapped.node;
document.getElementById("node").innerHTML = node;
console.log("")
document.getElementById("node").innerText = node;
}

document.addEventListener("DOMContentLoaded", initGrist);

0 comments on commit c95d556

Please sign in to comment.