Tabular View and Pivot Tables
We recommend reading the documentation about Data and <Container />
beforehand.
Configuration
The tabular view / pivot table can be configured through a JavaScript object inside the <Container />
's defaultValue
/value
prop.
The configuration allows to configure a widget without using UI controls, or sometimes allows to control options that do not have a UI control.
Here is a sample code to generate a tabular view and a pivot table using a simple query, but hiding the line numbers shown by default:
const TabularView = () => (
<Container
defaultValue={{
name: 'Tabular View',
value: {
body: {
configuration: {
tabular: {
lineNumbers: false,
},
},
mdx: `SELECT FROM [EquityDerivativesCube]`,
},
containerKey: 'tabular-view',
},
}}
/>
);
const PivotTable = () => (
<Container
defaultValue={{
name: 'Tabular View',
value: {
body: {
configuration: {
tabular: {
lineNumbers: false,
},
shouldRenderWizard: true,
wizard: {},
},
mdx: `SELECT FROM [EquityDerivativesCube]`,
},
containerKey: 'pivot-table',
},
}}
/>
);
Here is a list of configuration attributes for the tabular view and pivot table widget:
key | Type | Effect | Comment |
---|---|---|---|
addButtonFilter | String | Filters the fields displayed when clicking on the add button | One of [all , literal , numeric , measure ] |
cellEditor | Plugin | The cell editor to use (called on cell double-click) | |
cellRenderer | Plugin | The cell renderer to use for the widget, will be called for each cell of the table. | The default cell renderer is the caption cell renderer |
columnOrder | Array | ||
columns | Array | ||
columnsGroups | Array | ||
defaultOptions | Object | Options used by default for the columns | For example use the key width to have a default width for each column |
handlers | Plugin | ||
lineNumbers | Boolean | True to show the line numbers | true by default |
minRowSize | Number | Minimum height in pixels for all rows | 31px by default |
rowAction | Array[Plugin] | The row actions to display in the view | The are displayed by default at the right end of the widget |
rowStyle | Array[Plugin] | The style to apply to row of the tabular | |
sortingMode | String | The sorting mode to use for this tabular | One of [breaking , non-breaking ] |
Note: None of these configuration attributes are necessary to render a widget. They are provided for an advanced configuration of the view.