ZenotiHelp

Charting table column width distribution

ZTZenoti Docs Team Updated October 27, 2026 6 min readGuide

Charting table and datagrid layouts in forms automatically calculate how much horizontal space to assign each column. Understanding how this works helps you set appropriate minimum and maximum column widths in your form definitions so tables display clearly without unnecessary horizontal scrolling.

Audience: Form administrators who configure charting table and datagrid components in the form builder.


On this page


Before you begin

  • Your organization must have an active form that includes a charting table or datagrid component.

  • You need the following permissions to configure form definitions:

    Permission: Add under DotPhrases in the Administrator section of the security role β€” required to create new dot phrases used in table cells.

    Permission: Add under ServiceEntities in the Administrator section of the security role β€” required to create entity definitions that populate table columns.

  • Column width bounds (minWidth and maxWidth) must already be set on the individual columns within your form definition before the distribution algorithm runs. If these values are not configured, columns are sized based solely on their measured content width.


How column width distribution works

When a charting table or datagrid renders, Zenoti uses a two-pass algorithm to assign each column a final width. The goal is for the table to fill the full available horizontal space β€” rather than leaving unused space on the right β€” while still respecting the per-column bounds you set in the form definition.

Pass 1 β€” Clamp to bounds

Each column starts with a content-measured desired width. The system clamps this value to the column's configured minWidth and maxWidth:

  • If the desired width is below minWidth, the column is set to minWidth.
  • If the desired width exceeds maxWidth, the column is capped at maxWidth.
  • If the desired width falls between the two bounds, it is used as-is.

Pass 2 β€” Distribute remaining space

After clamping, the system checks whether the sum of all clamped widths is less than the total available table width. If space remains, it is distributed in two stages:

  1. Truncated columns first β€” Columns whose desired width was reduced by the maxWidth cap are given priority. Any remaining space is allocated to these columns first, up to the point where they would reach their uncapped desired width.
  2. Proportional distribution β€” Any space still remaining after the first stage is spread proportionally across all columns.

When the table is already too wide

If the sum of clamped widths already exceeds the available table width, the system returns the clamped widths unchanged and allows the table to scroll horizontally. No further redistribution is attempted.

Sub-pixel correction

Floating-point arithmetic during width calculations can leave a small fractional remainder. To prevent a table row from overflowing its container by a sub-pixel amount, the system adds any residual fraction to the last column's width.

Note: The two-pass algorithm runs automatically when the form renders. You do not trigger it manually β€” it responds to the minWidth and maxWidth values you set in the form definition.


Steps

Set column width bounds in the form builder

  1. Open the form builder and navigate to the charting table or datagrid component you want to configure.
  2. Select the column you want to adjust.
  3. In the column settings panel, configure the following:
    • Min width β€” Enter the minimum number of pixels the column may occupy. The algorithm will never render the column narrower than this value.
    • Max width β€” Enter the maximum number of pixels the column may occupy. The algorithm caps content-measured width at this value during the first pass, then attempts to expand the column back toward its uncapped width when spare space is available.
  4. Repeat steps 2–3 for each column in the table.
  5. Select Save to save the form definition.

Preview the rendered table layout

  1. After saving, open a test appointment or form session that includes the configured table.
  2. Verify that the columns fill the available horizontal width without a horizontal scrollbar.
  3. If a horizontal scrollbar appears, the sum of your minWidth values exceeds the available container width. Reduce one or more minWidth values and save again.
  4. If columns appear too narrow for their header text, increase the corresponding minWidth value so the first pass clamps the column at a more readable size.

Adjust for truncated header columns

When a column header is visually truncated after rendering, it means the column's content-measured desired width was larger than its maxWidth cap. The second pass will try to expand it β€” but only if other columns leave spare space after their own bounds are satisfied.

  1. Identify which column header is truncated.
  2. In the form builder, increase the maxWidth for that column.
  3. If the table is already filling full width (no spare space to distribute), you must reduce the maxWidth or minWidth of another column to free space.
  4. Select Save and re-verify the rendered layout.

Worked example: A charting table has three columns. Column A has a content-measured desired width of 120 px with a maxWidth of 100 px, so it is capped at 100 px in the first pass. Column B and Column C each measure 80 px and fit within their bounds. The available table width is 320 px, leaving 60 px of spare space (320 βˆ’ 100 βˆ’ 80 βˆ’ 80). In the second pass, Column A receives the 60 px of spare space first (because it was truncated by its maxWidth cap), bringing it to 160 px β€” still short of its 120 px desired width, but expanded as far as available space allows.


Tips

  • Set minWidth based on the widest expected header label. If a column header reads "Treatment Notes", set minWidth high enough to display the full label without truncation, so the first pass always starts at a readable floor.
  • Use maxWidth conservatively for data-heavy columns. If a column contains long free-text entries, capping its maxWidth too tightly will cause truncation even after the second pass distributes spare space.
  • Balance your column bounds across the full row. The sub-pixel correction only applies to the last column. If several columns have very tight bounds, rounding accumulates across all of them before the last column absorbs the residual. Reviewing the overall width budget before publishing a form prevents unexpected layout shifts.
  • When horizontal scrolling is acceptable by design, set each column's minWidth to the value that best displays its content and accept that the table will scroll. The algorithm does not attempt redistribution in this case, so each column renders at exactly its clamped width.
  • Test at the container width your staff actually use. The available table width depends on the device and browser viewport where the form is opened. A layout that fills the screen on a desktop may scroll on a tablet.

Troubleshooting

The table has empty space on the right side after rendering.

The total clamped column widths are less than the available table width, but the second-pass distribution did not fully account for all columns. Verify that each column has both a minWidth and a maxWidth set. If maxWidth is missing for any column, that column is excluded from the truncated-column priority stage, which can leave space unallocated.

A horizontal scrollbar appears even though the individual column widths look reasonable.

The sum of minWidth values across all columns exceeds the available container width. Because the algorithm returns clamped widths unchanged in this case, reducing one or more minWidth values is the only resolution. Start with the widest column and reduce its minWidth until the scrollbar disappears.

The last column appears slightly wider or narrower than expected.

This is the sub-pixel correction in action. The algorithm adds any fractional pixel remainder to the last column so the row does not overflow its container. This is expected behavior. If the visual difference is noticeable, adjust the maxWidth of the penultimate column slightly to reduce the accumulated remainder before it reaches the last column.

A column header is still truncated after increasing maxWidth.

If the table is already at full width (no spare space), increasing maxWidth alone does not help β€” the second pass can only expand truncated columns when there is remaining space after the first pass. Free space by reducing the minWidth or maxWidth of one or more other columns, then save and re-render.

Column widths change unexpectedly when the form is opened on different devices.

The available table width is determined by the rendering container on each device. Column widths are recalculated on every render. If consistency across devices is required, set identical minWidth and maxWidth values on each column so the algorithm has no room to distribute space and each column always renders at its clamped width.


Was this article helpful?
Your feedback helps us improve our documentation.