Skip to content

Commit 0c88e9a

Browse files
committed
[update] configuration updated, customization section removed
1 parent 03db1ce commit 0c88e9a

File tree

9 files changed

+106
-112
lines changed

9 files changed

+106
-112
lines changed

docs/api/config/configpanel-property.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: You can learn about the configPanel config in the documentation of
88

99
### Description
1010

11-
@short: Optional. Enables/disables the visibility of the Configuration panel in UI
11+
@short: Optional. Controls the visibility of the Configuration panel in UI
1212

1313
In UI the panel is hidden/shown by clicking the **Hide Settings** button.
1414

docs/api/events/open-filter-event.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The function may return either a boolean value or void. When it returns **false*
3232

3333
### Example
3434

35-
The example below shows how to make the configuration panel close upon closing the filter box:
35+
The example below shows how to make the Configuration panel close upon closing the filter box:
3636

3737
~~~jsx {20-27}
3838
const widget = new pivot.Pivot("#pivot", {

docs/api/overview/main-overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ new pivot.Pivot("#root", {
6868
| :------------------------------------------------- | :----------------------------------------------- |
6969
| [](../config/columnshape-property.md) | @getshort(../config/columnshape-property.md) |
7070
| [](../config/config-property.md) | @getshort(../config/config-property.md) |
71+
| [](../config/configpanel-property.md) | @getshort(../config/configpanel-property.md) |
7172
| [](../config/data-property.md) | @getshort(../config/data-property.md) |
7273
| [](../config/fields-property.md) | @getshort(../config/fields-property.md) |
7374
| [](../config/headershape-property.md) | @getshort(../config/headershape-property.md) |

docs/guides/configuration.md

Lines changed: 98 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,30 @@ You can configure the *Pivot* appearance and functionality via the corresponding
2222

2323
All instructions about working with data see here: [Working with data](guides/working-with-data)
2424

25-
## Datatable
26-
2725
You can configure and/or customize the following elements of the Pivot table:
2826

2927
- columns and rows
3028
- headers and footers
3129
- cells
3230
- the table sizes
3331

34-
### Resizing the table
32+
## Resizing the table
3533

3634
You can change the size of the table rows and columns, header and footer using the [`tableShape`](/api/config/tableshape-property) property.
3735

36+
The next sizes are applied by default:
37+
38+
~~~jsx
39+
const sizes = {
40+
rowHeight: 34,
41+
headerHeight: 30,
42+
footerHeight: 30,
43+
colWidth: 150,
44+
};
45+
~~~
46+
47+
Example:
48+
3849
~~~jsx
3950
const widget = new pivot.Pivot("#pivot", {
4051
fields,
@@ -66,7 +77,7 @@ const widget = new pivot.Pivot("#pivot", {
6677

6778
To set the width of specific column(s), apply the `width` parameter of the [columnShape property](/api/config/columnshape-property).
6879

69-
### Autosizing columns to content
80+
## Autosizing columns to content
7081

7182
The widget allows setting the minimum width value for all columns as well as enable sizing for the header, data only or combined auto sizing. To configure all these autosizing settings, you should apply the `autoWidth` parameter of the [`columnShape`](/api/config/columnshape-property) property.
7283

@@ -114,7 +125,81 @@ const pivotWidget = new pivot.Pivot("#pivot", {
114125
});
115126
~~~
116127

117-
### Making columns collapsible
128+
## Applying templates to cells
129+
130+
To set a template to cells, use the `templates` parameter of the [`tableShape`](/api/properties/tableshape-property) property. It's an object where each key is a field id and the value is a function that returns a string. All columns based on the specified field will have the related template applied.
131+
132+
In the example below we apply the template to the *score* values to display 2 digits after the decimal point for these values and we add the "€" sign to the *price* values.
133+
134+
~~~jsx {1-4,8}
135+
const templates = {
136+
price: (v) => (v ? "" + v : v),
137+
score: (v) => (v ? parseFloat(v).toFixed(2) : v)
138+
};
139+
140+
const widget = new pivot.Pivot("#pivot", {
141+
tableShape: {
142+
templates,
143+
},
144+
fields,
145+
data,
146+
config: {
147+
rows: ["studio", "genre"],
148+
columns: [],
149+
values: [
150+
{
151+
field: "title",
152+
method: "count",
153+
},
154+
{
155+
field: "score",
156+
method: "max",
157+
},
158+
{
159+
field: "price",
160+
method: "count",
161+
},
162+
],
163+
},
164+
});
165+
~~~
166+
167+
## Applying templates to headers
168+
169+
To define the format of text in headers, apply the `template` parameter of the [`headerShape`](/api/config/headershape-property) property. The parameter is the function that takes the field id, label and sublabel (the name of a method if any is applied) and returns the processed value (the default template is as follows: *template: (label, id, subLabel) => label + (subLabel ? `(${subLabel})` : "")*). By default, for the fields applied as values the label and method are shown (e.g., *Oil(count)*).
170+
If no other template is applied to columns, the value of the `label` parameter is displayed. If any [`predicate`](/config/predicates-property) template is applied, it will override the template of the `headerShape` property.
171+
172+
Example:
173+
174+
In the example below for the **values** fields the header will display the method name (subLabel) and the label:
175+
176+
~~~jsx {19-22}
177+
const pivotWidget = new pivot.Pivot("#pivot", {
178+
fields,
179+
data,
180+
config: {
181+
rows: ["studio", "genre"],
182+
columns: [],
183+
values: [
184+
{
185+
field: "title",
186+
method: "count",
187+
},
188+
{
189+
field: "score",
190+
method: "max",
191+
},
192+
],
193+
},
194+
195+
headerShape: {
196+
vertical: true,
197+
template: (label, id, subLabel) => id + (subLabel ? ` (${subLabel})` : ""),
198+
},
199+
});
200+
~~~
201+
202+
## Making columns collapsible
118203

119204
It's possible to collapse/expand columns that are under one header. To make columns collapsible, use the value of the `collapsible` parameter of the [`headerShape`](/api/config/headershape-property) property by setting it to **true**.
120205

@@ -142,7 +227,7 @@ const widget = new pivot.Pivot("#pivot", {
142227
});
143228
~~~
144229

145-
### Freezing columns
230+
## Freezing columns
146231

147232
The widget allows freezing columns on the left side, which makes the left-most columns static and visible while scrolling. To freeze columns, apply the **split** parameter of the [`tableShape`](/api/config/tableshape-property) property by setting the value of the `left` property to **true**.
148233

@@ -212,7 +297,7 @@ pivotWidget.api.on("render-table", (tableConfig) => {
212297
});
213298
~~~
214299

215-
### Sorting in columns
300+
## Sorting in columns
216301

217302
The sorting functionality is enabled by default. A user can click the column's header to sort data. To disable/enable sorting, apply the `sort` parameter of the [`columnShape`](/api/config/columnshape-property) property. In the example below we disable sorting.
218303

@@ -242,7 +327,7 @@ const pivotWidget = new pivot.Pivot("#pivot", {
242327

243328
For more information about sorting data, refer to [Sorting data](/guides/working-with-data#sorting-data).
244329

245-
### Enabling the tree mode
330+
## Enabling the tree mode
246331

247332
The widget allows presenting data in a hierarchical format with expandable rows. To switch to the tree mode, apply the `tree` parameter of the [`tableShape`](/api/config/tableshape-property) property by setting its value to **true** (default is **false**).
248333
To specify the parent row, put its name first in the `rows` array of the [`config`](/api/config/config-property) property.
@@ -282,7 +367,7 @@ const widget = new pivot.Pivot("#pivot", {
282367
});
283368
~~~
284369

285-
### Expanding/collapsing all rows
370+
## Expanding/collapsing all rows
286371

287372
To expand/collapse all rows, the **tree** mode should be enabled via the [`tableShape`](/api/config/tableshape-property) property and you should use the [`render-table`](/api/events/render-table-event) event that allows changing configuration settings, namely, making data rows expanded or collapsed (via the `row.open` parameter of the `config` object).
288373

@@ -349,7 +434,7 @@ document.body.appendChild(openAllButton);
349434
document.body.appendChild(closeAllButton);
350435
~~~
351436

352-
### Changing text orientation in headers
437+
## Changing text orientation in headers
353438

354439
To change text orientation from default horizontal to vertical, use the [`headerShape`](/api/config/headershape-propeprty) property and set its `vertical` parameter to **true**.
355440

@@ -387,15 +472,11 @@ const widget = new pivot.Pivot("#pivot", {
387472
});
388473
~~~
389474

475+
## Controlling visibility of Configuration panel
390476

477+
The Configuration panel is displayed by default. The widget provides the default functionality that allows controlling the visibility of the Configuration panel with the button click. It's made possible via the [`configPanel`](api/config/configPanel) property or [`show-config-panel`](/api/events/show-config-panel-event) event.
391478

392-
## Configuration panel
393-
394-
### Default settings
395-
396-
The configuration panel is displayed by default. The widget provides the default functionality that allows controlling the visibility of the Configuration panel with the button click. It's made possible via the [`configPanel`](api/config/configPanel) property or [`show-config-panel`](/api/events/show-config-panel-event) event.
397-
398-
### Hiding configuration panel
479+
### Hiding Configuration panel
399480

400481
To hide the panel, set the value of the [`configPanel`](api/config/configPanel) property to **false**.
401482

docs/guides/customization.md

Lines changed: 0 additions & 89 deletions
This file was deleted.

docs/guides/loading-exporting-data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: You can explore how to load and export data in the documentation of
88

99
The following types of information can be loaded into Pivot:
1010

11-
- [`data`](/api/config/data-property) - an array of objects, where each object represents the data row.
11+
- [`data`](/api/config/data-property) - an array of objects, where each object represents the data row
1212

1313
Example:
1414

docs/guides/localization.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ description: You can learn about the localization in the documentation of the DH
66

77
# Localization
88

9+
TBD
10+
911
You can localize all labels in the interface of JavaScript Pivot. For this purpose you need to create a new locale or modify a built-in one and apply it to Pivot.
1012

1113
## Default locale

docs/guides/working-with-data.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This page describes how to aggregate data in Pivot. For the instructions about l
1010

1111
## Defining fields
1212

13-
Use the [`fields`](/api/config/fields-property) property to add fields to the Pivot table.
13+
Use the [`fields`](/api/config/fields-property) property to add fields to the Pivot table. To add a new field, you should add a new object to the `fields` array.
1414

1515
Example:
1616

@@ -60,7 +60,7 @@ const widget = new pivot.Pivot("#pivot", {
6060

6161
The widget API allows configuring the sorting settings that are applied applied to all areas (values, columns and rows) during aggregation. The sorting in UI is enabled by clicking the column header.
6262

63-
To set default sorting values, apply the **sort** parameter of the [`fields`](/api/properties/fields-property) property. It accepts either the "asc" or "desc" value, or a custom sorting function.
63+
To set default sorting values, apply the **sort** parameter of the [`fields`](/api/config/fields-property) property. It accepts either the "asc" or "desc" value, or a custom sorting function.
6464

6565
In the example below we add clickable field labels and the sorting functionality that is enabled with the icon click:
6666

sidebars.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ module.exports = {
168168
items: [
169169
"guides/initialization",
170170
"guides/configuration",
171-
"guides/customization",
172171
"guides/loading-exporting-data",
173172
"guides/localization",
174173
"guides/stylization",

0 commit comments

Comments
 (0)