You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/config/headershape-property.md
+13-4
Original file line number
Diff line number
Diff line change
@@ -22,9 +22,15 @@ headerShape?: {
22
22
23
23
### Parameters
24
24
25
-
-`collapsible` - (optional) if set to **true**, dimension groups in the table are collapsible; it's set to **false** by default
26
-
-`vertical` - (optional) if set to **true**, changes the text orientation in all headers from horizontal to vertical; the default value is **false**
27
-
-`template` - (optional) defines the format of text in headers; by default, for the fields applied as rows the value of the `label` parameter is displayed and for the fields applied as values the label and method are shown (e.g., *Oil(count)*); the function takes the field id, label and the method or predicate id (if any) and returns the processed value; the default template is as follows:
25
+
-`collapsible` - (optional) if set to **true**, dimension groups in the table are collapsible. It's set to **false** by default
26
+
-`vertical` - (optional) if set to **true**, changes the text orientation in all headers from horizontal to vertical. The default value is **false**
27
+
-`cellStyle` - (optional) a function that applies a custom style to a header or footer cell. The function returns a name of css class and takes the following parameters:
28
+
-`field` (string) - (required) a string representing the field name the cell corresponds to. For the header of the tree column the field is ""
29
+
-`value` (string | number | date) - (required) the value of a cell
30
+
-`area` - (required) a string indicating the area of the table where a cell resides ("rows", "columns" or "values" area)
31
+
-`method` string - (optional) a string that can represent the operation performed for a field from the "values` area (e.g., "sum", "count", etc.) or the name of a predicate set for a field from the "columns" area
32
+
-`isTotal` - (optional) defines whether a cell belongs to a total column
33
+
-`template` - (optional) defines the format of text in headers. By default, for the fields applied as rows the value of the `label` parameter is displayed and for the fields applied as values the label and method are shown (e.g., *Oil(count)*). The function takes the field id, label and the method or predicate id (if any) and returns the processed value. The default template is as follows:
28
34
~~~js
29
35
template: (label, id, subLabel) =>
30
36
label + (subLabel ?` (${subLabel})`:"")
@@ -61,5 +67,8 @@ const table = new pivot.Pivot("#root", {
61
67
-[Pivot 2. Vertical orientation of text in grid headers](https://snippet.dhtmlx.com/4qroi8ka)
Copy file name to clipboardExpand all lines: docs/api/config/tableshape-property.md
+11-8
Original file line number
Diff line number
Diff line change
@@ -48,25 +48,25 @@ tableShape?: {
48
48
-`templates` - (optional) allows setting templates to a cell; it's an object where:
49
49
- each key is a field id
50
50
- the value is a function that returns a string and receives cell value and operation. All columns based on the specified field will have the related template applied. For example, it allows setting the units of measurement or returning the required number of digits after the decimal point for numeric values, etc. See the example below.
51
-
-`marks` - (optional) allows marking a cell with the required values; it's an object where keys are CSS class names and values are either a function or one of the predefined strings ("max", "min"). The function should return boolean for the checked value; if**true** is returned, the css class is assigned to the cell. More information with examples see here [Marking cells](/guides/stylization#cell-style).
51
+
-`marks` - (optional) allows marking a cell with the required values. It's an object where keys are CSS class names and values are either a function or one of the predefined strings ("max", "min"). The function should return boolean for the checked value. If**true** is returned, the css class is assigned to the cell. More information with examples see here [Marking cells](/guides/stylization#cell-style).
52
52
-`sizes` - (optional) defines the following size parameters of the table:
53
-
-`rowHeight` - (optional) the row height in the Pivot table in pixels; the default value is 34
53
+
-`rowHeight` - (optional) the row height in the Pivot table in pixels. The default value is 34
54
54
-`headerHeight` - (optional) the header height in pixels; the default value is 30
55
55
-`footerHeight` - (optional) the footer height in pixels; the default value is 30
56
56
-`columnWidth` - (optional) the column width in pixels; the default value is 150
57
-
-`cellStyle` - (optional) a function that applies a custom style to a cell; the function has the next parameters:
57
+
-`cellStyle` - (optional) a function that applies a custom style to a cell. The function has the next parameters:
58
58
-`field` - (required) a string representing the field name for which the style is applied
59
59
-`value` - (required) the value of the cell (the actual data for that particular row and column)
60
60
-`area` - (required) a string indicating the area of the table where a cell resides ("rows", "columns" or "values" area)
61
61
-`method` - (optional) a string that can represent the operation performed on a cell (e.g., "sum", "count", etc.)
62
62
-`isTotal` - (optional) defines whether a cell belongs to a total row, total column, or both: "row"|"column"|"both
63
63
The `cellStyle` function returns a string, which can be used as a CSS class name to apply specific styles to a cell.
64
-
-`tree` - (optional) if set to **true**, enables the tree mode when data can be presented with expandable rows; the default value is **false**; more information with examples see here [Switching to the tree mode](/guides/configuration/#enabling-the-tree-mode)
65
-
-`totalColumn` - (optional) if **true**, enables generating the total column with total values for rows (**false** is set by default); if the value is set to "sumOnly", the column with the total sum value will be generated (available only for sum operations)
66
-
-`totalRow` - (optional) if **true**, enables generating the footer with total values (**false** is set by default); if the value is set to "sumOnly", the row with the total row value will be generated (available only for sum operations)
64
+
-`tree` - (optional) if set to **true**, enables the tree mode when data can be presented with expandable rows, the default value is **false**. More information with examples see here [Switching to the tree mode](/guides/configuration/#enabling-the-tree-mode)
65
+
-`totalColumn` - (optional) if **true**, enables generating the total column with total values for rows (**false** is set by default). If the value is set to "sumOnly", the column with the total sum value will be generated (available only for sum operations)
66
+
-`totalRow` - (optional) if **true**, enables generating the footer with total values (**false** is set by default). If the value is set to "sumOnly", the row with the total row value will be generated (available only for sum operations)
67
67
-`cleanRows` - (optional) if set to **true**, the duplicate values in scale columns are hidden in the table view. The default value is **false**
68
68
-`split` - (optional) allows freezing columns on the right or left depending on the parameter specified (refer to [Freezing columns](/guides/configuration/#freezing-columns)):
69
-
-`left` (boolean) - if set to **true** (**false** is set by default), fixes the columns from the left, which makes columns static and visible while scrolling; the number of columns that are split is equal to the number of the rows fields that are defined in the [`config`](/api/config/config-property) property.
69
+
-`left` (boolean) - if set to **true** (**false** is set by default), fixes the columns from the left, which makes columns static and visible while scrolling. The number of columns that are split is equal to the number of the rows fields that are defined in the [`config`](/api/config/config-property) property
70
70
-`right` (boolean) - fixes total columns on the right; default value is **false**
71
71
72
72
By default, `tableShape` is undefined, implying that no total row, no total column is present, no templates and marks are applied, the data is shown as a table and not a tree, and columns are not fixed during scroll.
@@ -113,5 +113,8 @@ const table = new pivot.Pivot("#root", {
Copy file name to clipboardExpand all lines: docs/api/events/render-table-event.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -42,8 +42,10 @@ The callback of the action takes the `config` object with the following paramete
42
42
43
43
-`columns` - (optional) columns array with the next parameters for each object:
44
44
-`id` (number) - (required) the id of a column
45
-
-`cell` (any) - (optional) a template with the cell content (please, refer to [Applying templates to cells](/guides/configuration/#applying-templates-to-cells))
45
+
-`cell` (any) - (optional) a template with the cell content (please, refer to [Adding templates via the template helper](/guides/configuration/#adding-a-template-via-the-template-helper))
46
+
-`template` - (optional) the template that is defined via the [`tableShape`](/api/config/tableshape-property) property
46
47
-`fields` (array) - (optional) defines fields in the hierarchical column in the tree mode. Reflects fields displayed in this column on different levels
48
+
-`field` - (optional) it's a string which is the id of a field
47
49
-`method` (string) - (optional) a method, if defined for a field in this column
48
50
-`methods` (array) - (optional) defines methods applied to fields in the hierarchical column in the tree mode
49
51
-`format` (string or object) - (required) [date format](/guides/custom-formatting/#custom-date-formatting) or [number format](/guides/custom-formatting/#custom-number-formatting)
@@ -59,9 +61,7 @@ The callback of the action takes the `config` object with the following paramete
59
61
-`method` (string) - (required) the field predicate, if a cell belongs to "columns" area and predicate is defined
60
62
-`format` (string or object) - [date format](/guides/custom-formatting/#custom-date-formatting) or [number format](/guides/custom-formatting/#custom-number-formatting)
61
63
-`footer` - (optional) a header label or an object with footer settings which are the same as the header settings
62
-
-`field` - (optional) it's a string which is the id of a field
63
-
-`template` - (optional) the template that is defined via the [`tableShape`](/api/config/tableshape-property) property
64
-
-`data` - (optional) an array of objects with data for the table; each object represents a row:
64
+
-`data` - (optional) an array of objects with data for the table; each object represents a row:
65
65
-`id` (number) - (required) row id
66
66
-`values` (array) - (required) an array with row data
Copy file name to clipboardExpand all lines: docs/api/helpers/template.md
+6-4
Original file line number
Diff line number
Diff line change
@@ -35,8 +35,10 @@ For body cells the function takes the next parameters:
35
35
-`$level` (boolean)- (optional) branch index
36
36
-`column` - (required) an object with column data:
37
37
-`id` (number) - (required) the id of a column
38
-
-`cell` (any) - (optional) a template with the cell content (please, refer to [Applying templates to cells](/guides/configuration/#applying-templates-to-cells))
38
+
-`cell` (any) - (optional) a template with the cell content (please, refer to [Adding templates via the template helper](/guides/configuration/#adding-a-template-via-the-template-helper))
39
+
-`template` - (optional) the template that is defined via the [`tableShape`](/api/config/tableshape-property) property
39
40
-`fields` (array) - (optional) defines fields in the hierarchical column in the tree mode. Reflects fields displayed in this column on different levels
41
+
-`field` - (optional) it's a string which is the id of a field
40
42
-`method` (string) - (optional) a method, if defined for a field in this column
41
43
-`methods` (array) - (optional) defines methods applied to fields in the hierarchical column in the tree mode
42
44
-`format` (string or object) - (required) [date format](/guides/custom-formatting/#custom-date-formatting) or [number format](/guides/custom-formatting/#custom-number-formatting)
@@ -49,12 +51,12 @@ For body cells the function takes the next parameters:
49
51
-`colspan` (number) - (optional) the number of columns a header should span
50
52
-`value` (any) - (required) raw value, if a cell belongs to "columns" area
51
53
-`field` (string) - (required) a field, which value is displayed, if a cell belongs to "columns" area
52
-
-`method` (string) - (required) a field predicate, if a cell belongs to "columns" area and predicate is defined
53
-
-`format` (string or object) - (required) [date format](/guides/custom-formatting/#custom-date-formatting) or [number format](/guides/custom-formatting/#custom-number-formatting)
54
+
-`method` (string) - (required) the field predicate, if a cell belongs to "columns" area and predicate is defined
55
+
-`format` (string or object) - [date format](/guides/custom-formatting/#custom-date-formatting) or [number format](/guides/custom-formatting/#custom-number-formatting)
54
56
55
57
For header cells the function parameters are the following:
56
58
57
-
-`value` (any) - (required) raw cell value
59
+
-`value` (any) - (required) a raw cell value
58
60
-`method` (string) - (optional) a predicate used for a column
59
61
-`field` (string) - (optional) a field which value is displayed in a cell
Copy file name to clipboardExpand all lines: docs/guides/configuration.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -170,7 +170,7 @@ const table = new pivot.Pivot("#root", {
170
170
171
171
### Adding a template via the template helper
172
172
173
-
You can also define HTML templates using the [`pivot.template`](/api/helpers/template) helper. You need to apply it right before the table renders, which is done by intercepting the [render-table](/api/events/render-table-event) event using the [api.intercept()](/api/internal/intercept-method) method. Use this event to modify the table's config, namely the `columns` array. Define the template via the `pivot.template` helper.
173
+
You can also define a template as a cell property of the `column` object via the [`pivot.template`](/api/helpers/template) helper. You need to apply it right before the table renders, which is done by intercepting the [render-table](/api/events/render-table-event) event using the [api.intercept()](/api/internal/intercept-method) method. Use this event to modify the table's config, namely the `columns` array. Define the template via the `pivot.template` helper.
174
174
175
175
The example shows how you can add icons (star or flag icon) to body cells based on their field (id, user_score):
176
176
@@ -201,7 +201,7 @@ function scoreTemplate(value) {
@@ -251,7 +251,7 @@ const table = new pivot.Pivot("#root", {
251
251
252
252
### Adding templates via the template helper
253
253
254
-
You can also define HTML templates using the [`pivot.template`](/api/helpers/template) helper. You need to apply it right before the table renders, which is done by intercepting the [render-table](/api/events/render-table-event) event using the [api.intercept()](/api/internal/intercept-method) method. Use this event to modify the table's config, namely the `header` parameter in the `columns` array. Define the template via the `pivot.template` helper.
254
+
You can also define a template as a cell property of the `header` object via the [`pivot.template`](/api/helpers/template) helper. You need to apply it right before the table renders, which is done by intercepting the [render-table](/api/events/render-table-event) event using the [api.intercept()](/api/internal/intercept-method) method. Use this event to modify the table's config, namely the `header` parameter in the `columns` array. Define the template via the `pivot.template` helper.
255
255
256
256
The example below shows how to add icons to:
257
257
@@ -276,10 +276,10 @@ function statusTemplate(value) {
0 commit comments