Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 6969

How to populate table using for loop?

$
0
0

@tesicg wrote:

I have an MVC application with view that uses JavaScript file where I get the data from MVC controller using jQuery's AJAX call and want to populate table's node. My code looks as following:

myDiagram.nodeTemplateMap.add("table",
    $(go.Node, go.Panel.Auto,
        $(go.Shape, { fill: "white", stroke: "gray", strokeWidth: 3 }),
        { movable: true },
        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
        $(go.Panel, "Table",
            $(go.TextBlock, "Object Properties",
            { row: 0, column: 1, font: "bold 10pt sans-serif", margin: 2 }),

            // drawn before row 1:
            $(go.RowColumnDefinition,
            { row: 1, separatorStrokeWidth: 1.5, separatorStroke: "black" }),
            // drawn before column 1:
            $(go.RowColumnDefinition,
            { column: 1, separatorStrokeWidth: 1.5, separatorStroke: "black" }),

            for (var i = 0; i < data.ObjectPropertiesList.length; i++) {
                $(go.TextBlock, data.ObjectPropertiesList[i].Item1, { row: 1, column: 0, stroke: "green", margin: 2 }),
                $(go.TextBlock, data.ObjectPropertiesList[i].Item2, { row: 1, column: 1, margin: 2 });
            }});
}

But, there are some syntax and other errors. For example, there is syntax error on for loop.

Could you suggest me, please, how to overcome this issue?

Posts: 9

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6969