Skip to content

Commit 5df6636

Browse files
committed
[update] configuration.applyong-te,plates-via-teplate-helper upd, styling changed, custom-formatting corrected
1 parent c9d6196 commit 5df6636

File tree

4 files changed

+25
-28
lines changed

4 files changed

+25
-28
lines changed

docs/api/config/tableshape-property.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ tableShape?: {
4040
right?: boolean,
4141
},
4242
cellStyle?: (
43-
field: string,
44-
value: any,
45-
area: "rows"|"columns"|"values",
46-
method?: string,
47-
isTotal?: "row"|"column"|"both")
48-
=> string,
43+
field: string,
44+
value: any,
45+
area: "rows"|"columns"|"values",
46+
method?: string,
47+
isTotal?: "row"|"column"|"both")
48+
=> string,
4949
};
5050
~~~
5151

docs/guides/configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ const table = new pivot.Pivot("#root", {
170170

171171
### Adding a template via the template helper
172172

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.
173+
You can insert HTML content to table cells via the [`pivot.template`](/api/helpers/template) helper by defining a template as a `cell` property of the `column` object. You need to apply the template 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.
174174

175175
The example shows how you can add icons (star or flag icon) to body cells based on their field (id, user_score):
176176

@@ -251,7 +251,7 @@ const table = new pivot.Pivot("#root", {
251251
252252
### Adding templates via the template helper
253253
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.
254+
You can insert HTML content to header cells via the [`pivot.template`](/api/helpers/template) helper by defining a template as a `cell` property of the header cell object. You need to apply the template 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.
255255
256256
The example below shows how to add icons to:
257257

docs/guides/custom-formatting.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const fields = [
1818
];
1919
~~~
2020

21-
By default, the format for numeric values limits fraction digits to 3 and applies group separation for the integer part. The `format` parameter allows you to display numeric values without group separation (for example, years):
21+
By default, the format for numeric values limits fraction digits to 3 and applies group separation for the integer part. You can cancel formatting by setting `format` to *false* in the `field` configuration:
2222

2323
~~~js
2424
const fields = [
@@ -86,7 +86,7 @@ const fields = [
8686
];
8787
~~~
8888

89-
In the example below we set the date format to "%d %M %Y %H:%i" for the "date" field only. The format displays day, full month name, year, hours, and minutes, e.g., "24 April 2025 14:30".
89+
In the example below we set the date format to "%d %M %Y %H:%i" for the "date" field only. The format displays day, full month name, year, hours, and minutes, e.g., "24 April 2025 14:30". In case you need to disable formatting of some fields, set the `format` parameter of the [`fields`](/api/config/fields-property) property to *false*.
9090

9191
~~~jsx
9292
const fields = [
@@ -134,9 +134,6 @@ new pivot.Pivot("#pivot", {
134134
});
135135
~~~
136136

137-
:::info
138-
In case you need to disable formatting of some fields, set the `format` parameter of the [`fields`](/api/config/fields-property) property to *false*.
139-
:::
140137

141138
## Example
142139

docs/guides/stylization.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ You can also apply a custom style to the scroll bar of Pivot. For this, you can
100100

101101
## Cell style
102102

103-
To apply a CSS class to the table body cell, use the `cellStyle` parameter of the [`tableShape`](/api/config/tableshape-property) property. The style of the header and footer cells can be customized via the `cellStyle` parameter of the [`headerShape`](/api/config/tableshape-property) property. In both cases the `cellStyle` function returns a string, which can be used as a CSS class name to apply specific styles to a cell.
103+
To apply a CSS class to the table body or footer cells, use the `cellStyle` parameter of the [`tableShape`](/api/config/tableshape-property) property. The style of the header cells can be customized via the `cellStyle` parameter of the [`headerShape`](/api/config/tableshape-property) property. In both cases the `cellStyle` function returns a string, which can be used as a CSS class name to apply specific styles to a cell.
104104

105105
In the example below the styles of cells in the table body and headers are customized in the following way:
106106
- for the table body cells, styles are applied dynamically based on cell values (e.g., "Down", "Up", "Idle") in the "status" field and on total values (greater than 40 or less than 5)
@@ -155,20 +155,9 @@ const widget = new pivot.Pivot("#pivot", {
155155
});
156156
~~~
157157

158-
It's also possible to customize the style of total columns and total rows via the `wx-total` class:
158+
## Marking values in cells
159159

160-
~~~html
161-
<style>
162-
.wx-cell.wx-total {
163-
background: #fafafb;
164-
font-weight: var(--wx-header-font-weight);
165-
}
166-
</style>
167-
~~~
168-
169-
## Marking cells
170-
171-
The widget API allows marking cells with the required values. You can do it by applying the `marks` parameter of the [`tableShape`](/api/config/tableshape-property) property. You need to do the following:
160+
The widget API allows marking required values in cells. You can do it by applying the `marks` parameter of the [`tableShape`](/api/config/tableshape-property) property. You need to do the following:
172161
- create a CSS class to be applied to the marked cell
173162
- add the CSS class name as the parameter of the `marks` object
174163
- set its value which can be a custom 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.
@@ -224,7 +213,7 @@ const table = new pivot.Pivot("#root", {
224213
</style>
225214
~~~
226215

227-
## Aligning numbers in a cell
216+
## Specific CSS classes
228217

229218
By default, in the table body numbers are aligned to the right with the help of the built-in `.wx-number` CSS class. The exception is the hierarchical column in the tree mode (when `tree` is set to **true** for the [`tableShape`](/api/config/tableshape-property) property). To reset the default number alignment, change the related CSS class.
230219

@@ -236,6 +225,17 @@ By default, in the table body numbers are aligned to the right with the help of
236225
</style>
237226
~~~
238227

228+
It's also possible to customize the style of total columns and total rows via the ` .wx-total` CSS class:
229+
230+
~~~html
231+
<style>
232+
.wx-cell.wx-total {
233+
background: #fafafb;
234+
font-weight: var(--wx-header-font-weight);
235+
}
236+
</style>
237+
~~~
238+
239239
## Example
240240

241241
In this snippet you can see how to apply a custom style to Pivot

0 commit comments

Comments
 (0)