Dynamic height measured on render

The row details need no height set in advance: the table measures them when they render. The details of a row render when the row opens them, and server details when their loading ends; the table reads the height of their element with the other reads of that frame, and the opening animates to it. Short and long details of one table each open to their own height, and the application sets no height anywhere.

  1. Expand Details
  2. Expand other Details
  3. Collapse Details
Take control of the cursor, clicking on the button or the table
Loading
Items per page:
import type {BroConfig} from '@table-bro/core';

// No height of the details: the table measures them when they render
const config: BroConfig = {
  rowDetailsIsland: true,
  rowDetailsComponent: 'bro-cell-details' // your Details-component as a Custom Element
};

How the table measures the details

  1. Details of the client

    When a row opens its details, the table creates the element of rowDetailsComponent in a new details row and sets its property row, and the element renders its content as it connects. The table reads the height of the element and opens the row from 0 to that height, with the opacity of the details. Every opening creates the element again and measures it again: details whose content depends on the row, or has changed since the last opening, open to the height they have now.

  2. Server details

    With rowDetailsServer: true the element loads hidden in the row of the aux table, while the row shows the progress. When the element reports the end of its loading, the event bro-details-server-loaded with detail 1, the table moves it into the details row and measures it there, with its loaded content. The component renders its content before it reports 1, as the example on Default Details does. A component that renders its content later, after a request of its own, loads its details with rowDetailsServer: without it the table measures the element before its content is there.

  3. Island Details and Default Details

    Both take the height that the table measures. With Default Details the rows below the details move down by it as they open. With Island Details the shadow of the row, its rounded corners and the spaces around the open details follow the height in every frame of the opening.

Limits

Details are at least as high as a row, --bro-row-height of the skin. The table measures the details once per opening: content that changes while the details are open keeps the height of the opening, and the next opening measures it again. Details opened in a hidden table, as in a closed tab, take the height of a row until their next opening.

The opening is kinetic by default; rowDetailsMotion: 'eased' opens the details in the time of --bro-details-duration.

Dynamic height with server-side data loading

Default Details that load from the server: the table measures each one when its loading ends.

  1. Expand Details
  2. Expand other Details
  3. Collapse Details
Take control of the cursor, clicking on the button or the table
Loading
Items per page:
import type {BroConfig} from '@table-bro/core';

// The table measures the details when the component reports the end of their loading
const config: BroConfig = {
  rowDetailsComponent: 'bro-cell-details', // your Details-component as a Custom Element

  rowDetailsServer: true
};
DJ