Custom Properties

Is it possible to define custom properties for seat in gojs seating chart please help me how to define it

Yes. First, I should point out that the Seating Chart sample was designed so that there would be separate templates for each combination of tables and seating configuration. That way the model data for each table would not need to hold any table-specific configuration information except the template name – i.e. the category.

But if you are modifying the tables and the number and position of the seats, then you probably need to store in the model that information for each table. The way to do that is to use an item array, with each item a JavaScript object representing a seat. That way you can add whatever properties you like for each seat, and use data binding in the seat template to affect each seat based on the data properties for each seat.

Note that the original templates create seats in a template by calling a function (named “Seat”) that constructed a Panel with some GraphObjects in it. Each such panel was added directly to the Node, which is also a “Spot” Panel.

Instead of doing that in the template, set the Node.itemTemplate to be the prototypical “seat”, and data bind Node.itemArray to a property in your node data that is a JavaScript Array of objects, one per seat. Information that was passed to the “Seat” function, such as the name and the alignment spots, need to be data bound. And you can add data binding of GraphObject properties to your own data properties.

Note that the binding context for Bindings in your item template will be the seat object in the array, not the whole node data object. The original seat was created with bindings of “fill” and “angle”, but those won’t work any more unless you put the properties into your seat objects.

Read more about item arrays at: http://gojs.net/latest/intro/itemarrays.html .
There are many samples that use this mechanism; these samples might be instructive: http://gojs.net/latest/samples/entityRelationship.html and http://gojs.net/latest/samples/pipes.html .

Hi Walter

Thanks for your help…