Skip to content
This repository was archived by the owner on Jun 15, 2019. It is now read-only.
This repository was archived by the owner on Jun 15, 2019. It is now read-only.

Shrinking a row after a call to table.toString() results in a table with no outer right border #35

@mgroenhoff

Description

@mgroenhoff

When calling table.toString(), either directly or indirectly (via table.width), tableLayout.computeWidths() and tableLayout.computeHeights() modifies this.options.colWidths and this.options.rowHeights respectively which causes the values to be reused or left behind in some way (i haven't tracked down the exact cause).

The use case:
I have some code that creates a row with some cells and after a while it checks the width of the resulting table (via table.width thus calling table.toString() etc.). If it then exceeds a certain amount if pops the last cell of the row and adds it to a new row and adding that row to the table.

The problem:
Because table.options.colWidths now contains an element for the cell i moved from the end of the first row to the beginning of the second row. The table.toString() somehow results in a table with no outer right border.

My temporary solution:

// Force recalculation of column widths
table.options.colWidths = [];
table.options.rowHeights = []; // Probably unnecessary but just to be sure
return table.toString();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions