Skip to content

Commit bf2bfb4

Browse files
committed
[fix] correct code samples for grid in a sub-row
1 parent 0cc6521 commit bf2bfb4

2 files changed

Lines changed: 14 additions & 16 deletions

File tree

docs/grid/api/grid_subrow_config.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ For Grid (in the TreeGrid mode) or Tree used in a sub-row it is important to spe
7373
For example:
7474

7575
~~~jsx {8,16}
76-
grid = new dhx.Grid("grid_container", {
76+
const grid = new dhx.Grid("grid_container", {
7777
columns: [
7878
// columns config
7979
],
80-
data: dataset,
81-
subRow: (row) => {
82-
subGrid = new dhx.Grid(null, {
80+
data: dataset,
81+
subRow: (row) => (
82+
new dhx.Grid(null, {
8383
rootParent: "root", // Add the root id
8484
columns: [
8585
{ id: "country", header: [{ text: "Country" }] },
@@ -89,10 +89,9 @@ grid = new dhx.Grid("grid_container", {
8989
data: row.data,
9090
autoWidth: true,
9191
type: "tree",
92-
});
93-
return subGrid;
94-
},
95-
});
92+
})
93+
),
94+
});
9695
~~~
9796

9897
**Related sample:** [Grid. Row expander. Full config](https://snippet.dhtmlx.com/xdw2037t)

docs/grid/configuration.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,13 +2226,13 @@ For Grid (in the TreeGrid mode) or Tree used in a sub-row it is important to spe
22262226
For example:
22272227

22282228
~~~jsx {8,16}
2229-
grid = new dhx.Grid("grid_container", {
2229+
const grid = new dhx.Grid("grid_container", {
22302230
columns: [
22312231
// columns config
22322232
],
2233-
data: dataset,
2234-
subRow: (row) => {
2235-
subGrid = new dhx.Grid(null, {
2233+
data: dataset,
2234+
subRow: (row) => (
2235+
new dhx.Grid(null, {
22362236
rootParent: "root", // Add the root id
22372237
columns: [
22382238
{ id: "country", header: [{ text: "Country" }] },
@@ -2242,10 +2242,9 @@ grid = new dhx.Grid("grid_container", {
22422242
data: row.data,
22432243
autoWidth: true,
22442244
type: "tree",
2245-
});
2246-
return subGrid;
2247-
},
2248-
});
2245+
})
2246+
),
2247+
});
22492248
~~~
22502249

22512250
### Adjusting configuration of sub-rows

0 commit comments

Comments
 (0)