[SeatingChart]_Structure of guest model

Dear all,
The example shows this:

  myGuests.model = new go.GraphLinksModel([
    { key: "Tyrion Lannister" },
    { key: "Daenerys Targaryen", plus: 3 },  // dragons, of course       
    { key: "Hodor" }

Using “key” as a text to display. Now I want to re-define this structure like this

  myGuests.model = new go.GraphLinksModel([
    { key: "1", name: "Tyrion Lannister" },
    { key: "2", name: "Daenerys Targaryen", plus: 3 },  // dragons, of course       
    { key: "3", name: "Hodor" }

and use key as ID(identify) and name for displaying.

Sure. What’s the problem?

Dear @walter,
I want to change the structure of guest model. How to do this?
The example is using “key” to display. However, I want to use “name” to display.

I’ve just found this:

                    new go.Binding("text", "", function (data) {
                        var s = data.name;
                        if (data.plus) s += " +" + data.plus.toString();


                        return s;

I changed code at line:

var s = data.name;
then I achieve what I want.
Anyway, Thank you everyone.

I didn’t realize that was the usage of the property that you needed to change. You will need to check any other uses of that property.

And I hope you remove those calls to console.log!

1 Like