Skip to content

Commit 4c386ec

Browse files
committed
[add] grid column properties pages
1 parent 2f5e1cf commit 4c386ec

33 files changed

+1399
-62
lines changed

docs/grid/api/api_gridcolumn_properties.md

Lines changed: 6 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -16,65 +16,12 @@ columns:[
1616
minWidth?: number, // 20 by default
1717
maxWidth?: number,
1818
autoWidth?: boolean, // false by default
19-
header: [
20-
{
21-
text?: string | ((content: {
22-
[key: string]: string | number | null
23-
}) => string),
24-
tooltip?: boolean | object, // true by default
25-
tooltipTemplate?: (
26-
content: { value: string } & { [key: string]: string | number | null },
27-
header: IHeader,
28-
column: ICol
29-
) => string | boolean,
30-
align?: "left" | "center" | "right", // "left" by default
31-
colspan?: number,
32-
rowspan?: number,
33-
css?: string,
34-
content?: "inputFilter" | "selectFilter" | "comboFilter",
35-
filterConfig?: {
36-
filter?: (item: any, input: string) => boolean,
37-
multiselection?: boolean,
38-
readonly?: boolean,
39-
placeholder?: string,
40-
virtual?: boolean,
41-
template?: function
42-
},
43-
customFilter?: (item: any, input: string) => boolean,
44-
headerSort?: boolean, // true by default
45-
sortAs?: (cellValue: any) => string | number,
46-
htmlEnable?: boolean, // false by default
47-
}
48-
],
49-
footer?: [
50-
{
51-
text?: string | ((content: {
52-
[key: string]: string | number | null
53-
}) => string),
54-
tooltip?: boolean | object, // true by default
55-
tooltipTemplate?: (
56-
content: { value: string } & { [key: string]: string | number | null },
57-
header: IHeader,
58-
column: ICol
59-
) => string | boolean,
60-
align?: "left" | "center" | "right", // "left" by default
61-
colspan?: number,
62-
rowspan?: number,
63-
css?: string,
64-
htmlEnable?: boolean, // false by default
65-
},
66-
],
19+
header: [ /* header rows configuration */],
20+
footer?: [ /* footer rows configuration */],
6721
type?: "string" | "number" | "boolean" | "date", // "string" by default
6822
numberMask?:
6923
| {
70-
prefix?: string, // "" by default (before the value)
71-
suffix?: string, // "" by default (after the value)
72-
groupSeparator?: string, // "," by default
73-
decSeparator?: string, // "." by default
74-
allowNegative?: boolean, // true by default
75-
maxIntLength?: number,
76-
maxDecLength?: number,
77-
minDecLength?: number // 0 by default
24+
// numberMask configuration
7825
}
7926
| boolean,
8027
patternMask?:
@@ -107,8 +54,8 @@ columns:[
10754
groupable?: boolean, // false by default
10855
closable?: boolean, // true by default
10956
summary?: {
110-
[key: string]: string | [string, string] | (row: IRow[]) => string | number
111-
} | string
57+
[key: string]: string | [string, string] | (row: IRow[]) => string | number
58+
} | string
11259
},
11360
// more column objects
11461
]
@@ -139,7 +86,7 @@ columns:[
13986
<td>(optional) enables/disables the ability of a column to adjust its size to the size of Grid, <i>false</i> by default<br><br>Also note:<br><li>If <b>autoWidth</b> is set for a column, the width of the column is calculated on the base of the sizes of the container of the grid and the values of the <b>minWidth/maxWidth</b> properties if they are set for the column.</li><li>The property is ignored if the <a href="../../../grid/configuration/#autosize-for-columns">adjust</a> property is used.</li><li>If the <b>width</b> property is specified in the configuration object of a column, the <b>autoWidth</b> property won't work for this column.</li></td>
14087
</tr>
14188
<tr>
142-
<td><b id="header">header</b></td>
89+
<td><a href="../gridcolumn_properties/gridcolumn_header_property/"><b id="header">header</b></a></td>
14390
<td>(required) an array of objects with header rows configuration. Each header object may include:<ul><li><a href="../../configuration/#headerfooter-text"><b>text</b></a> - (optional) the text of a header or a callback function which is called with the following parameter:<ul><li><b>content</b> - an object with the content of the header tooltip that contains the calculated values as *key:value* pairs, where:<ul><li>the *key* is either the key defined in the list or the functor name</li><li>the *value* can be a *string/number* or *null*</li></ul> The calculated values are taken either from the <b>summary</b> config option of the component or the <b>summary</b> config option of a column</li></ul></li><li><b>tooltip</b> - (optional) enables/disables the header tooltip, or sets the configuration object with the tooltip settings; <i>true</i> by default. When set as an object, the <b>tooltip</b> config can have the following properties:<ul><li><b>force</b> - (optional) forces opening of a tooltip; if set to true, the <b>showDelay</b> and <b>hideDelay</b> settings are ignored, *false* by default</li><li><b>showDelay</b> - (optional) the time period that should pass before showing a tooltip, in ms</li><li><b>hideDelay</b> - (optional) the time period that should pass before hiding a tooltip, in ms</li><li><b>margin</b> - (optional) the margin between the node and tooltip; *8px* by default</li><li><b>position</b> - (optional) the position of a tooltip: *"right"*, *"bottom"*, *"center"*, *"left"*, *"top"*; *"bottom"* by default</li><li><b>css</b> - (optional) the style of a tooltip box</li></ul></li><li><a href="../../configuration/#column-headerfooter-tooltip"><b>tooltipTemplate</b></a> - (optional) sets a template for the header tooltip. Takes into account the <a href="../../configuration/#html-content-of-grid-columns">htmlEnable</a> property. The value of the <b>tooltipTemplate</b> property is a callback function which is called with the following parameters:<ul><li><b>content</b> - an object with the content of the header tooltip. Contains two properties which are available either from the component's or from the column's configuration:<ul><li><b>value</b> - the value rendered in a cell, including the applied templates</li><li>an object with the calculated values of the <b>summary</b> property, set as *key:value* pairs where:<ul><li>the *key* is either the key defined in the list or the functor name</li><li>the *value* can be a *string/number* or *null*</li></ul></li></ul></li><li><b>header</b> - the object of the column header</li><li><b>column</b> - the object of a column</li></ul>Return <i>false</i> to disable the tooltip</li><li><a href="../../configuration/#alignment"><b>align</b></a> - (optional) aligns data in the header: *"left"* | *"center"* | *"right"*, <i>"left"</i> by default</li><li><b>colspan</b> - (optional) the number of columns in a colspan</li><li><b>rowspan</b> - (optional) the number of rows in a rowspan </li><li><b>css</b> - (optional) styling to be applied to a header</li><li><a href="../../configuration/#headerfooter-filters"><b>content</b></a> - (optional) additional content of a header, which can be one of the filters: *"inputFilter"* | *"selectFilter"* | *"comboFilter"*</li><li><a href="../../configuration/#headerfooter-filters"><b>filterConfig</b></a> - (optional) a configuration object for <b>"comboFilter"</b>. It can contain a set of properties:<ul><li><b>filter</b> - (optional) sets a custom function for filtering Combo Box options</li><li> <b>multiselection</b> - (optional) enables selection of multiple options</li><li><b>readonly</b> - (optional) makes ComboBox readonly (it is only possible to select options from the list, without entering words in the input). The default value of the <b>readonly</b> property depends on the following conditions:<ul><li>the `readonly:true` is set as a default value, if `htmlEnable:true` is set for a column and there is no template specified for a column</li><li>in all other cases, `readonly:false` is set by default</li></ul></li><li><b>placeholder</b> - (optional) sets a placeholder in the input of ComboBox</li><li><b>virtual</b> - (optional) enables dynamic loading of data on scrolling the list of options</li><li><b>template</b> - (optional) a function which returns a template with content for the filter options. Takes an option item as a parameter:<ul><li><b>item</b> - (object) an option item</li></ul></li></ul></li><li><a href="../../configuration/#customizing-headerfooter-filters"><b>customFilter</b></a> - (optional) a custom function for extended filtering. It takes two parameters:<ul><li><b>item</b> - (required) a data item the value of which should be compared</li><li> <b>input</b> - (required) the value of the option selected in the filter</li></ul>and returns <i>true/false</i> to specify whether the data item should be displayed in the grid after filtering</li><li><b>headerSort</b> - (optional) enables/disables sorting by clicking the header, <i>true</i> by default</li><li><b>sortAs</b> - (optional) a function that defines the type to sort data as (e.g. string, number, date, etc.)</li><li><b>htmlEnable</b> - (optional) <i>false</i> by default. If set to <i>true</i>, specifies the HTML content (inner HTML) of a header. If set to <i>false</i>, the content of the header cells will be displayed as a <i>string</i> value</li></ul><br><b>Related Sample: </b><a href="https://snippet.dhtmlx.com/eol76o68" target="_blank">Grid. Grouped headers (spans)</a></td>
14491
</tr>
14592
<tr>

docs/grid/api/grid_summary_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ console.log(summary); // { totalPopulation: 1000000, totalArea: 50000, density:
8282

8383
@descr:
8484

85-
**Related article:** [Summary of calculated values](grid/configuration.md#custom-statistics-in-the-column-headerfooter-and-spans)
85+
**Related article:** [Custom statistics in the column header/footer and spans](../../configuration/#custom-statistics-in-the-column-headerfooter-and-spans)
8686

8787
**Related**: [getSummary](grid/api/grid_getsummary_method.md)
8888

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
sidebar_label: adjust
3+
title: JavaScript Grid column - adjust Config
4+
description: You can explore the adjust config of Grid column in the documentation of the DHTMLX JavaScript UI library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Suite.
5+
---
6+
7+
# adjust
8+
9+
@short: Optional. Defines whether the width of a column is automatically adjusted to its content
10+
11+
## Usage
12+
13+
~~~jsx
14+
adjust?: "data" | "header" | "footer" | boolean,
15+
~~~
16+
17+
@default: false
18+
19+
@example:
20+
const grid = new dhx.Grid("grid_container", {
21+
columns: [
22+
{ id: "country", header: [{ text: "Country" }], adjust: "header" },
23+
{ id: "population", header: [{ text: "Population" }] }
24+
],
25+
adjust: false,
26+
data: dataset
27+
});
28+
29+
@descr:
30+
- The property has a priority over the `autoWidth` property if it is specified either for the grid or for the column, and over the `width` property of the column.
31+
- The width the columns will be adjusted to also depends on the values of the `minWidth/maxWidth` properties if they are set for a column.
32+
33+
**Related article**: [Autosize for columns](grid/configuration.md#autosize-for-columns)
34+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
sidebar_label: align
3+
title: JavaScript Grid column - align Config
4+
description: You can explore the align config of Grid column in the documentation of the DHTMLX JavaScript UI library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Suite.
5+
---
6+
7+
# align
8+
9+
@short: Optional. Aligns data in a column
10+
11+
## Usage
12+
13+
~~~jsx
14+
align?: "left" | "center" | "right",
15+
~~~
16+
17+
@default: "left"
18+
19+
@example:
20+
const grid = new dhx.Grid("grid_container", {
21+
columns: [
22+
{ id: "name", header: [{ text: "Name", align: "center" }], align: "right"}
23+
// more options
24+
],
25+
data: dataset
26+
});
27+
28+
@descr:
29+
30+
**Related article**: [Alignment](grid/configuration.md#alignment)
31+
32+
**Related sample**: [Grid. Content align](https://snippet.dhtmlx.com/eyreddku)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
sidebar_label: autoWidth
3+
title: JavaScript Grid column - autoWidth Config
4+
description: You can explore the autoWidth config of Grid column in the documentation of the DHTMLX JavaScript UI library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Suite.
5+
---
6+
7+
# autoWidth
8+
9+
@short: Optional. Enables/disables the ability of a column to adjust its size to the size of Grid
10+
11+
## Usage
12+
13+
~~~jsx
14+
autoWidth?: boolean,
15+
~~~
16+
17+
@default: false
18+
19+
@example:
20+
const grid = new dhx.Grid("grid_container", {
21+
columns: [
22+
{ width: 200, id: "country", header: [{ text: "Country" }], autoWidth: false },
23+
{ width: 150, id: "population", header: [{ text: "Population" }] },
24+
],
25+
autoWidth: true,
26+
data: dataset
27+
});
28+
29+
30+
@descr:
31+
Also note:
32+
33+
- If `autoWidth` is set for a column, the width of the column is calculated on the base of the sizes of the container of the grid and the values of the `minWidth/maxWidth` properties if they are set for the column.
34+
- The property is ignored if the [`adjust`](grid/configuration.md#autosize-for-columns) property is used.
35+
- If the `width` property is specified in the configuration object of a column, the `autoWidth` property won't work for this column.
36+
37+
**Related article**: [Autowidth for columns](grid/configuration.md/#autowidth-for-columns)
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
sidebar_label: closable
3+
title: JavaScript Grid column - closable Config
4+
description: You can explore the closable config of Grid column in the documentation of the DHTMLX JavaScript UI library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Suite.
5+
---
6+
7+
# closable
8+
9+
@short: Optional. Either allows closing a particular element of the group panel or makes it permanently enabled
10+
11+
:::tip pro version only
12+
The described functionality requires PRO version of the DHTMLX Grid (or DHTMLX Suite) package.
13+
:::
14+
15+
## Usage
16+
17+
~~~jsx
18+
closable?: boolean,
19+
~~~
20+
21+
@default: true
22+
23+
@example:
24+
25+
const grid = new dhx.Grid("grid_container", {
26+
columns: [
27+
{
28+
width: 150,
29+
id: "country",
30+
header: [{ text: "Country" }],
31+
// grouping of the "country" column is permanently enabled
32+
// and can't be switched off via the group panel
33+
closable: false,
34+
},
35+
{
36+
width: 150,
37+
id: "population",
38+
header: [{ text: "Population" }],
39+
groupable: true,
40+
},
41+
{ width: 150, id: "destiny", header: [{ text: "Density (P/Km²)" }] },
42+
{ width: 150, id: "area", header: [{ text: "Land Area (Km²)" }] },
43+
],
44+
group: {
45+
order: ["country", "population"]
46+
},
47+
groupable: true,
48+
data: dataset
49+
});
50+
51+
@descr:
52+
53+
**Related article**: [Making group panel elements closable](grid/usage.md#making-group-panel-elements-closable)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
sidebar_label: dateFormat
3+
title: JavaScript Grid column - dateFormat Config
4+
description: You can explore the dateFormat config of Grid column in the documentation of the DHTMLX JavaScript UI library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Suite.
5+
---
6+
7+
# dateFormat
8+
9+
@short: Optional. Defines the format of dates
10+
11+
:::note
12+
The date format must include delimiters (spaces or symbols), otherwise an error will be thrown
13+
:::
14+
15+
## Usage
16+
17+
~~~jsx
18+
dateFormat?: string,
19+
~~~
20+
21+
@default: "%M %d %Y"
22+
23+
@example:
24+
const grid = new dhx.Grid("grid_container", {
25+
columns: [
26+
{
27+
width: 150, id: "date", header: [{ text: "Date" }],
28+
type: "date", dateFormat: "%M %d %Y"
29+
},
30+
// more columns
31+
],
32+
data: dataset
33+
});
34+
35+
@descr:
36+
37+
**Related article**: [Setting the format for dates](grid/configuration.md#setting-the-format-for-dates)
38+
39+
**Related sample**: [Grid. Data formats (percent, currency, date and combination with templates)](https://snippet.dhtmlx.com/ox37nvdm)
40+
41+
42+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
sidebar_label: draggable
3+
title: JavaScript Grid column - draggable Config
4+
description: You can explore the draggable config of Grid column in the documentation of the DHTMLX JavaScript UI library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Suite.
5+
---
6+
7+
# draggable
8+
9+
@short: Optional. Defines whether a column is draggable
10+
11+
## Usage
12+
13+
~~~jsx
14+
draggable?: boolean,
15+
~~~
16+
17+
@default: false
18+
19+
@example:
20+
21+
const grid = new dhx.Grid("grid_container", {
22+
columns: [
23+
{ width: 200, id: "country", header: [{ text: "Country" }]},
24+
{ width: 150, id: "land", header: [{ text: "Land" }] },
25+
{ width: 150, id: "density", header: [{ text: "Density" }], draggable: false }
26+
],
27+
data: dataset,
28+
dragItem: "column",
29+
});
30+
31+
@descr:
32+
33+
**Related article**: [Drag-n-drop inside the grid](grid/configuration.md#drag-n-drop-inside-the-grid)
34+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
sidebar_label: editable
3+
title: JavaScript Grid column - editable Config
4+
description: You can explore the editable config of Grid column in the documentation of the DHTMLX JavaScript UI library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Suite.
5+
---
6+
7+
# editable
8+
9+
@short: Optional. Defines whether a column is editable
10+
11+
## Usage
12+
13+
~~~jsx
14+
editable?: boolean,
15+
~~~
16+
17+
@default: false
18+
19+
@example:
20+
const grid = new dhx.Grid("grid_container", {
21+
columns: [
22+
{
23+
width: 150, id:"project",
24+
editable: false,
25+
header: [
26+
{text: "Project"}, {content: "selectFilter"}
27+
]
28+
},
29+
{ width:150, id: "owner", header: [{text: "Owner"},{content: "inputFilter"}]},
30+
{ width:150, id: "hours", header: [{text: "Hours"}, {content: "inputFilter"}]},
31+
// more columns
32+
],
33+
data: data,
34+
editable: true
35+
});
36+
37+
38+
@descr:
39+
40+
**Related article**: [Editing Grid and separate columns](grid/configuration.md#editing-grid-and-separate-columns)
41+
42+

0 commit comments

Comments
 (0)