How to set width automatically for columns in Gojs TreeTable

Hi there,

Im trying to create tree table using gojs where I want to display multiple rows. I m able to create tree table diagram but in my tree table I have to set width for each column which I dont want.

Is there a way we can render tree table like below one without setting column width or if we can do it programmatically instead of hardcoding?


Also is it possible to add border to this tree table the way we do with bootstraps table? I have spent time on this and i know we can set two properties
defaultRowSeparatorStroke and defaultColumnSeparatorStroke but looks like these arent working for me.

here is code pen link:

Yes, you can set the columns widths programmatically by something like:

node.diagram.commit(diag => {
  const table = node.findObject(...);  // find the "Table" Panel
  table.getColumnDefinition(...).width = ...;
  table.getColumnDefinition(...).width = ...;
  table.getColumnDefinition(...).width = ...;

Thanks walter,
I will try and set column widths programmatically but does it mean that I have to set column widths and I can not ignore or omit this

Also can you please comment on the second question I asked about the table borders

If you want to control the widths of each of the columns, you need to set their RowColumnDefinition.widths or RowColumnDefinition.minimum and/or maximum widths, or else you could control the GraphObject.width of the whole “Table” Panel and specify RowColumnDefinition.sizing to tell which columns should just get their natural width and which ones should get extra width if available.
GoJS Table Panels -- Northwoods Software

To add a border to any GraphObject, wrap it with an “Auto” Panel whose first element is a Shape.
GoJS Panels -- Northwoods Software