function viewGrid()

in web/js/main.js [182:232]


function viewGrid(graph) {

    // console.log("viewGrid", graph.data.nodes.length)

    const gridContainer = document.getElementById("grid-container")
    gridContainer.innerHTML = ""

    const columns = [
        { name: "id", hidden: true },
        "name", "label", "title", "type",
    ]

    for (const node of graph.data.nodes) {
        for (const key in node.properties) {
            console.log("Checking key", key)
            const idx = columns.indexOf(key)
            if (idx === -1) {
                columns.push(key)
            }
        }
    }

    console.info("columns", columns)

    const data = []
    for (const node of graph.data.nodes) {
        const a = []
        for (const key of columns) {
            if (key === "label") {
                a.push(node.labels[0])
            } else if (key === "id") {
                a.push(node.id)
            } else {
                const val = node.properties[key]
                if (val) a.push(val)
                else a.push("")
            }
        }
        data.push(a)
    }

    new Grid({
        columns,
        data,
        sort: true,
        resizable: true,
    }).render(gridContainer)

    document.getElementById("canvas-container").style.display = "none"
    gridContainer.style.display = "block"
}