Skip to content

Commit db961ae

Browse files
authored
Merge pull request #72 from DHTMLX/next
Fix description of the column object properties of the Grid group object
2 parents 99aa143 + d60ca1f commit db961ae

File tree

2 files changed

+29
-39
lines changed

2 files changed

+29
-39
lines changed

docs/grid/api/grid_group_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ You can find the detailed description of the `group` object properties with exam
7373
- a tuple `[string, TAggregate]` that specifies the field and the aggregation type ("sum", "count", "min", "max", "avg") from the `dhx.methods` helper
7474
- a user-defined aggregation function `((row: IRow[]) => string | number)`
7575
- `summary` - (optional) specifies where the total row is rendered - at the `top` or at the `bottom` of the group
76-
- `column` - (optional) defines the configuration of a column that renders values of the grouped data. This column will be used as a main one for structuring and rendering data grouped by value
76+
- `column` - (optional) defines the [configuration of a column](grid/usage.md/#configuration-of-the-column-property-of-the-group-object) that renders values of the grouped data. This column will be used as a main one for structuring and rendering data grouped by value
7777

7878
@example:
7979
const grid = new dhx.Grid("grid_container", {

docs/grid/usage.md

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The API of DHTMLX Grid allows setting configuration of columns, getting an objec
1818

1919
You can specify the configuration of Grid columns on the fly via the [](grid/api/grid_setcolumns_method.md) method. It takes an array with columns objects as a parameter.
2020

21-
~~~js
21+
~~~jsx
2222
grid.setColumns([
2323
{ id: "a", header: [{ text: "New header for column a" }] },
2424
{ id: "b", header: [{ text: "New header for column b" }] },
@@ -32,7 +32,7 @@ You can find the full list of the available configuration options of a Grid colu
3232

3333
It is possible to return an object with attributes of a column via its id. Use the [](grid/api/grid_getcolumn_method.md) method for this purpose.
3434

35-
~~~js
35+
~~~jsx
3636
const column = grid.getColumn("b"); // ->
3737
// -> { width: 100, id: "b", header: Array(1), $cellCss: {…}, type: "string" }
3838
~~~
@@ -43,7 +43,7 @@ The method returns an object with configuration of the specified column. You can
4343

4444
There is the [](grid/api/grid_getcellrect_method.md) method that returns an object with coordinates of a cell. The method takes as parameters the ids of the row and the column the cell belongs to:
4545

46-
~~~js
46+
~~~jsx
4747
const rect = grid.getCellRect("1", "c");
4848
// -> { x: 200, y: -40, height: 40, width: 200 }
4949
~~~
@@ -75,7 +75,7 @@ The return object includes the following attributes:
7575

7676
It is possible to show and hide a column in the grid via the [](grid/api/grid_showcolumn_method.md) and [](grid/api/grid_hidecolumn_method.md) methods.
7777

78-
~~~js
78+
~~~jsx
7979
//showing a column
8080
grid.showColumn(colId);
8181
//hiding a column
@@ -90,7 +90,7 @@ Since the object of a column has the [hidden](grid/configuration.md#hidden-colum
9090

9191
You can check whether a column is hidden or shown on a page using the [](grid/api/grid_iscolumnhidden_method.md) method. The method returns *true*, if a column is hidden, and *false* if it's visible.
9292

93-
~~~js
93+
~~~jsx
9494
grid.isColumnHidden("country"); // -> true|false
9595
~~~
9696

@@ -100,7 +100,7 @@ grid.isColumnHidden("country"); // -> true|false
100100

101101
You may want to manipulate a filter specified in the header of a grid, for example, to set/unset focus on the filter, to change the filter, or clear it. To do that, you should apply the [](grid/api/grid_getheaderfilter_method.md) method to get an object with methods of the header filter and apply the necessary method. For example:
102102

103-
~~~js
103+
~~~jsx
104104
// set a value by which a column will be filtered
105105
grid.getHeaderFilter("country").setValue("Brazil");
106106

@@ -114,7 +114,7 @@ grid.getHeaderFilter("country").blur();
114114
const filter = grid.getHeaderFilter("country").getFilter();
115115
console.log(filter);
116116
// -> returns Combobox
117-
//  {config: {…}, _uid: 'u1670500020936', events: o, data: d, popup: f, …}
117+
// {config: {…}, _uid: 'u1670500020936', events: o, data: d, popup: f, …}
118118

119119
// clear the value set in the filter
120120
grid.getHeaderFilter("country").clear();
@@ -130,7 +130,7 @@ grid.getHeaderFilter("country").clear();
130130

131131
You may add a new row into the grid by using the [](../data_collection/api/datacollection_add_method.md) method of **DataCollection**:
132132

133-
~~~js
133+
~~~jsx
134134
grid.data.add({
135135
"country": "Estonia",
136136
"population": "1326535",
@@ -150,13 +150,13 @@ grid.data.add({
150150

151151
To remove the necessary row from the grid, apply the [](../data_collection/api/datacollection_remove_method.md) method of **DataCollection**. Pass the id of the row that should be removed to the method:
152152

153-
~~~js
153+
~~~jsx
154154
grid.data.remove("5");
155155
~~~
156156

157157
Here is an example of removing a currently selected row:
158158

159-
~~~js
159+
~~~jsx
160160
const cell = grid.selection.getCell();
161161
grid.data.remove(cell.row.id);
162162
~~~
@@ -169,15 +169,15 @@ For more information about the selection functionality in Grid, read the [Select
169169

170170
If you need to remove all rows at once, use the [](../data_collection/api/datacollection_removeall_method.md) method of **DataCollection**:
171171

172-
~~~js
172+
~~~jsx
173173
grid.data.removeAll();
174174
~~~
175175

176176
### Hiding/showing a row
177177

178178
Starting from v7.0, it is possible to show and hide a row in the grid via the [](grid/api/grid_showrow_method.md) and [](grid/api/grid_hiderow_method.md) methods.
179179

180-
~~~js
180+
~~~jsx
181181
//showing a row
182182
grid.showRow(rowId);
183183
//hiding a row
@@ -190,7 +190,7 @@ grid.hideRow(rowId);
190190

191191
You can check whether a row is hidden or shown on a page using the [](grid/api/grid_isrowhidden_method.md) method. The method returns *true*, if a row is hidden, and *false* if it's visible.
192192

193-
~~~js
193+
~~~jsx
194194
grid.isRowHidden("1"); // -> true|false
195195
~~~
196196

@@ -204,7 +204,7 @@ You can manipulate columns and rows spans inside the grid with the help of the c
204204

205205
In order to add a column/row span into the grid, use the [](grid/api/grid_addspan_method.md) method. Pass an object with configuration of a span as a parameter:
206206

207-
~~~js
207+
~~~jsx
208208
grid.addSpan({
209209
row: "0",
210210
column: "a",
@@ -248,7 +248,7 @@ These are possible fields of a span object:
248248

249249
You can return the column/row span a cell is a part of using the [](grid/api/grid_getspan_method.md) method. It takes the ids of the row and the column the cell belongs to as parameters:
250250

251-
~~~js
251+
~~~jsx
252252
const span = grid.getSpan("10", "a");
253253
// -> { row: "10", column: "a", colspan: 4, text: "Some header", css: "myCustomColspan" }
254254
~~~
@@ -259,7 +259,7 @@ As a result, you'll get an object with a span configuration, if any span include
259259

260260
To remove an existing span, make use of the [](grid/api/grid_removespan_method.md) method. It takes the ids of the row and the column as parameters:
261261

262-
~~~js
262+
~~~jsx
263263
grid.removeSpan("10", "a");
264264
~~~
265265

@@ -283,7 +283,7 @@ You can filter grid data by the specified criteria with the help of the `filter(
283283
</table>
284284
<br/>
285285

286-
~~~js
286+
~~~jsx
287287
grid.data.filter(function (item) {
288288
return item.a > 0 && item.b !== "Apple";
289289
});
@@ -453,15 +453,15 @@ You can easily edit the desired cell of a grid with the help of the [](grid/api/
453453

454454
For example, you can edit the first cell of the "project" column like this:
455455

456-
~~~js
456+
~~~jsx
457457
grid.editCell(grid.data.getId(0), "project");
458458
~~~
459459

460460
**Related sample**: [Grid. Edit the first cell](https://snippet.dhtmlx.com/pqbax5vs)
461461

462462
To finish editing of a cell, use the [](grid/api/grid_editend_method.md) method. The method takes a *boolean* value as a parameter to define whether the edited data will be saved after the editing of a cell is complete (if *true*, the made changes won't be saved).
463463

464-
~~~js
464+
~~~jsx
465465
grid.editEnd(); // the edited data will be saved
466466

467467
grid.editEnd(true); // the edited data won't be saved
@@ -930,6 +930,8 @@ const grid = new dhx.Grid("grid_container", {
930930
});
931931
~~~
932932

933+
#### Configuration of the column property of the group object
934+
933935
A column with grouped data may contain the following properties in its configuration:
934936

935937
~~~jsx
@@ -946,19 +948,9 @@ column: {
946948
) => string | boolean,
947949
align?: "left" | "center" | "right", // "left" by default
948950
css?: string,
949-
content?: "inputFilter" | "selectFilter" | "comboFilter",
950-
filterConfig?: {
951-
filter?: (item: any, input: string) => boolean,
952-
multiselection?: boolean,
953-
readonly?: boolean,
954-
placeholder?: string,
955-
virtual?: boolean,
956-
template?: function
957-
},
958-
customFilter?: (item: any, input: string) => boolean,
959951
headerSort?: boolean, // true by default
960952
sortAs?: (cellValue: any) => string | number,
961-
htmlEnable?: boolean, // false by default
953+
htmlEnable?: boolean, // true by default
962954
}
963955
],
964956
footer?: [
@@ -972,14 +964,12 @@ column: {
972964
) => string | boolean,
973965
align?: "left" | "center" | "right", // "left" by default
974966
css?: string,
975-
htmlEnable?: boolean, // false by default
967+
htmlEnable?: boolean, // true by default
976968
},
977969
],
978970
align?: "left" | "center" | "right", // "left" by default
979971
resizable?: boolean, // false by default
980972
sortable?: boolean, // true by default
981-
mark?: { min?: string, max?: string } |
982-
(cell: any, columnCells: any[], row?: object, column?: object) => string,
983973
template?: (cellValue: any, row: object, column: object) => string,
984974
tooltip?: boolean | object, // true by default
985975
tooltipTemplate?: (cellValue: any, row: object, column: object) => string,
@@ -1185,15 +1175,15 @@ The API of DHTMLX Grid provides the possibility to set scrolls to the necessary
11851175

11861176
You can scroll grid content to exact position defined by x and y coordinates via the [](grid/api/grid_scroll_method.md) method. Pass the coordinates as parameters of the method.
11871177

1188-
~~~js
1178+
~~~jsx
11891179
grid.scroll(75, 230);
11901180
~~~
11911181

11921182
### Scrolling to specific grid cell
11931183

11941184
It is also possible to scroll grid content to a particular cell. Pass the ids of the row and the column as parameters:
11951185

1196-
~~~js
1186+
~~~jsx
11971187
grid.scrollTo("15", "c");
11981188
~~~
11991189

@@ -1203,7 +1193,7 @@ grid.scrollTo("15", "c");
12031193

12041194
To return the current state of scroll, use the [](grid/api/grid_getscrollstate_method.md) method.
12051195

1206-
~~~js
1196+
~~~jsx
12071197
const state = grid.getScrollState(); // -> {x:0, y:0}
12081198
~~~
12091199

@@ -1213,15 +1203,15 @@ It returns an object with x,y coordinates of a position the grid has been scroll
12131203

12141204
In case you've changed some configuration settings of a grid, you can repaint it on a page via the [](grid/api/grid_paint_method.md) method:
12151205

1216-
~~~js
1206+
~~~jsx
12171207
grid.paint();
12181208
~~~
12191209

12201210
## Destructing Grid
12211211

12221212
When it's necessary to release resources occupied by Grid during its activity, you can make use of the [](grid/api/grid_destructor_method.md) method:
12231213

1224-
~~~js
1214+
~~~jsx
12251215
grid.destructor();
12261216
~~~
12271217

0 commit comments

Comments
 (0)