Table row is gone when resizing

I have a table panel nested within a spot panel. The table panel has 3 rows: header, body and the footer. I want the body to resize and fill but the header and footer stay fixed in height and only grow in width.

But the moment I resize the node, the footer row disappears. See the gif attached. Here’s the code:

const mainTable = new go.Panel(go.Panel.Table, {
  name: "box",
  stretch: go.GraphObject.Fill,
  minSize: new go.Size(240, 100),
  alignment: go.Spot.TopLeft,
  toLinkable: false,
})
  // Column 0
  .addRowColumnDefinition(
    new go.RowColumnDefinition({
      column: 0,
      sizing: go.RowColumnDefinition.None,
    })
  )
  // Column 1
  .addRowColumnDefinition(
    new go.RowColumnDefinition({
      column: 1,
    })
  )
  // Row 0
  .addRowColumnDefinition(
    new go.RowColumnDefinition({
      row: 0,
      sizing: go.RowColumnDefinition.None,
    })
  )
  // Row 1
  .addRowColumnDefinition(
    new go.RowColumnDefinition({
      row: 1,
      sizing: go.RowColumnDefinition.Default,
      stretch: go.GraphObject.Fill,
    })
  )
  // Row 2
  .addRowColumnDefinition(
    new go.RowColumnDefinition({
      row: 2,
      sizing: go.RowColumnDefinition.None,
      stretch: go.GraphObject.None,
    })
  )
  .add(
    new go.Picture({
      source: "https://www.google.com/s2/favicons?sz=64&domain_url=figma.com",
      width: 16,
      height: 16,
      row: 0,
      column: 0,
      alignment: go.Spot.MiddleLeft,
      margin: 4,
    })
  )
  .add(
    // Header text
    new go.TextBlock("Action 1", {
      row: 0,
      column: 1,
      alignment: go.Spot.MiddleLeft,
      margin: new go.Margin(0, 0, 0, 4),
      verticalAlignment: go.Spot.MiddleLeft,
      stretch: go.GraphObject.None,
      editable: false,
    }).bind(new go.Binding("text", "name").makeTwoWay())
  )
  .add(
    // Description text
    new go.TextBlock(
      "Some description which are highly recommended in this day and age",
      {
        row: 1,
        columnSpan: 2,
        alignment: go.Spot.TopLeft,
        stretch: go.GraphObject.Fill,
        // margin: new go.Margin(8, 8, 8, 8),
        background: "whitesmoke",
      }
    ).bind(new go.Binding("text", "description").makeTwoWay())
  )
  .add(
    new go.Panel(go.Panel.Auto, {
      row: 2,
      columnSpan: 2,
      stretch: go.GraphObject.Fill,
      background: "red",
    }).add(
      new go.Shape("Circle", {
        fill: "orange",
        strokeWidth: 0,
        width: 16,
        height: 16,
        fromSpot: go.Spot.Center,
        toSpot: go.Spot.Center,
        cursor: "pointer",
      })
    )
  );

const nodeTemplate = new go.Node(go.Panel.Spot, {
  resizable: true,
  resizeObjectName: "box",
  background: "lightgray",
  stretch: go.GraphObject.Fill,
})
  .add(mainTable)
  .add(
    // Left
    new go.Shape("Circle", {
      fill: "gold",
      width: 16,
      height: 16,
      alignment: go.Spot.LeftCenter,
      alignmentFocus: go.Spot.Center,
    })
  )
  .add(
    // Right
    new go.Shape("Circle", {
      fill: "gold",
      width: 16,
      height: 16,
      alignment: go.Spot.RightCenter,
      alignmentFocus: go.Spot.Center,
    })
  )
  .add(
    // Top
    new go.Shape("Circle", {
      fill: "gold",
      width: 16,
      height: 16,
      alignment: go.Spot.TopCenter,
      alignmentFocus: go.Spot.Center,
    })
  )
  .add(
    // Bottom
    new go.Shape("Circle", {
      fill: "gold",
      width: 16,
      height: 16,
      alignment: go.Spot.BottomCenter,
      alignmentFocus: go.Spot.Center,
    })
  );


gojs-table

Hmmm, we need to investigate this further – it seems like a bug. Thanks for reporting it.

I have simplified your code, basically getting rid of unnecessary property settings, and hopefully making it easier to read and maintain. I’m guessing that what you posted is the simplified version of your actual node template, for our examination.

const mainTable = new go.Panel(go.Panel.Table, {
    name: "box",
    minSize: new go.Size(240, 100),
    alignment: go.Spot.TopLeft,
    toLinkable: false,  //??? not needed here
  })
  .bind("desiredSize", "size", go.Size.parse, go.Size.stringify) //?? you might want this
  // Column 0
  .addColumnDefinition(0, { sizing: go.RowColumnDefinition.None })
  // Column 1
  .addColumnDefinition(1, {})
  // Row 0
  .addRowDefinition(0, { sizing: go.RowColumnDefinition.None })
  // Row 1
  .addRowDefinition(1, { stretch: go.GraphObject.Fill })
  // Row 2
  .addRowDefinition(2, {
      sizing: go.RowColumnDefinition.None,
      stretch: go.GraphObject.None,
    })
  .add(
    new go.Picture({
      source: "https://www.google.com/s2/favicons?sz=64&domain_url=figma.com",
      width: 16,
      height: 16,
      row: 0,
      column: 0,
      alignment: go.Spot.MiddleLeft,
      margin: 4,
    }),
    // Header text
    new go.TextBlock("Action 1", {
      row: 0,
      column: 1,
      alignment: go.Spot.MiddleLeft,
      margin: new go.Margin(0, 0, 0, 4),
      verticalAlignment: go.Spot.MiddleLeft,
      stretch: go.GraphObject.None,
      editable: false,  //?? should be true given TwoWay Binding
    }).bind(new go.Binding("text", "name").makeTwoWay()),
    // Description text
    new go.TextBlock(
      "Some description which are highly recommended in this day and age",
      {
        row: 1,
        columnSpan: 2,
        alignment: go.Spot.TopLeft,
        stretch: go.GraphObject.Fill,
        // margin: new go.Margin(8, 8, 8, 8),
        background: "whitesmoke",
        //?? might want to set editable: true, given TwoWay Binding
      }
    ).bind(new go.Binding("text", "description").makeTwoWay()),
    new go.Panel(go.Panel.Auto, {
      row: 2,
      columnSpan: 2,
      stretch: go.GraphObject.Horizontal,
      background: "red",
    }).add(
      new go.Shape("Circle", {
        fill: "orange",
        strokeWidth: 0,
        width: 16,
        height: 16,
        //??? should this have a setting or binding of "portId"?
        fromSpot: go.Spot.Center,
        toSpot: go.Spot.Center,
        cursor: "pointer",
      })
    )
  );

myDiagram.nodeTemplate = new go.Node(go.Panel.Spot, {
    resizable: true,
    resizeObjectName: "box",
    background: "lightgray",
  })
  .add(
    mainTable,
    // Left
    new go.Shape("Circle", {
      fill: "gold",
      width: 16,
      height: 16,
      alignment: go.Spot.LeftCenter,
    }),
    // Right
    new go.Shape("Circle", {
      fill: "gold",
      width: 16,
      height: 16,
      alignment: go.Spot.RightCenter,
    }),
    // Top
    new go.Shape("Circle", {
      fill: "gold",
      width: 16,
      height: 16,
      alignment: go.Spot.TopCenter,
    }),
    // Bottom
    new go.Shape("Circle", {
      fill: "gold",
      width: 16,
      height: 16,
      alignment: go.Spot.BottomCenter,
    })
  );
1 Like

You’re right that it’s a simplified version of the actual code I have. I tired to trim extraneous bits and declutter it before asking the question. Thanks for looking into it.

Thanks for reporting. This is definitely a bug, we’ll have a release soon.

1 Like

Can you try this provisional build of GoJS and let me know if it works as you’d expect?

https://gojs.net/temp/go2313a.js

Seems to be fine. Had to change the Auto panel stretch to Horizontal:

stretch: go.GraphObject.Horizontal,

And it looks OK to me.

gojs_table_beta_build

While you’re at it, is there any reason Vertical and Horizontal are typed as any versus EnumValue?

We mention why in the comment:

    /**
     * GraphObjects with this enumeration as the value of GraphObject#stretch
     * are scaled as much as possible in the x-axis. In another context, can be used as a value of PanelLayout, so type is "any".
     * @constant
     */
    static Horizontal: any;

The problem is that Panel is a subclass of GraphObject so Panel.Horizontal (a panel type) masks GraphObject.Horizontal (a stretch)

We think that something of a mistake, and in GoJS 3.0 (beta coming Jan or Feb) we remove the EnumValue class and use TypeScript enums internally, with new values, so that there will be go.Stretch.Horizontal. Old values will remain for compatibility, however, and may remain typed as any in this case.

1 Like

Amazing, thanks for this quick turn around.

Try latest: GoJS 2.3.13 released

1 Like

Thanks, seems fixed with 2.3.13.