Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autowidth changed to required #20

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/api/config/columnshape-property.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ columnShape?: {
- `width` - (optional) defines the width of a column; it's an object where each key is a field id and the value is the width of the column in pixels
- `autoWidth` - (optional) an object that defines how column width should be calculated automatically. The default configuration uses 20 rows, and the width is calculated based on the header and data, with each field analyzed only once. The object parameters are the following:
- `columns` - (optional) an object where each key is a field id and the boolean value defines whether column width should be calculated automatically
- `auto` - (optional) if set to **header**, adjusts the width to the header text; if set to **data**, adjusts the width to the cell with the widest content; if set to **true**, the width is adjusted to the content of both headers and cell.
Autowidth is not set by default (**false**) and the `width` value is set or the value of the `colWidth` from the [`tableShape`](/api/config/tableshape-property) property is applied.
- `auto` - (required) if set to **header**, adjusts the width to the header text; if set to **data**, adjusts the width to the cell with the widest content; if set to **true**, the width is adjusted to the content of both headers and cell.
If autowidth is set to **false**, the `width` value is set or the value of the `colWidth` from the [`tableShape`](/api/config/tableshape-property) property is applied.
- `maxRows` - (optional) the number of rows to be processed for the autoWidth calculation
- `firstOnly` - (optional) if set to **true** (default), each field of the same data is analyzed only once to calculate the column width; in case of multiple columns based on the same data (e.g., the *oil* field with the *count* operation and the *oil* field with the *sum* operation), only data in the first one will be analyzed and the others will inherit this width

## Example

~~~jsx {18-30}
~~~jsx {18-31}
const table = new pivot.Pivot("#root", {
fields,
data,
Expand All @@ -69,6 +69,7 @@ const table = new pivot.Pivot("#root", {
title: true,
score: true
},
auto: true,
// analyze all fields
firstOnly: false
}
Expand Down
Loading