You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/grid/api/grid_getsubrow_method.md
+42-7Lines changed: 42 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,13 +18,48 @@ Note that the method works if a sub-row is in the visible area or if the `preser
18
18
-`id: string | number` - the id of a row
19
19
20
20
@returns:
21
-
An object that includes:
22
-
- the configuration of the sub-row, including both user-defined settings and the default settings (`expanded`, `fullWidth`, `padding`, `height`, `toggleItem`, `preserve`, `css`)
23
-
-`element: HTMLElement | null` - the parent container of the current sub-row
24
-
-`view: string | object | null`:
25
-
- a *string*, if the sub-row is set by the HTML content
26
-
- an *object* instance to interact with, if a sub-row is an instance of a nested component (for example, Grid)
27
-
- *null*, if the sub-row is unavailable (for example, it is hidden or placed outside the visible area and the `preserve` config is not specified)
21
+
An object that includes the following properties:
22
+
23
+
<table>
24
+
<tbody>
25
+
<tr>
26
+
<td><b>css</b></td>
27
+
<td>(<i>string</i>) user-defined CSS classes for a sub-row</td>
28
+
</tr>
29
+
<tr>
30
+
<td><b>element</b></td>
31
+
<td>(<i>HTMLElement | null</i>) the parent container of the current sub-row</td>
32
+
</tr>
33
+
<tr>
34
+
<td><b>expanded</b></td>
35
+
<td>(<i>boolean</i>) defines whether a sub-row is expanded by default, <i>false</i> by default</td>
36
+
</tr>
37
+
<tr>
38
+
<td><b>fullWidth</b></td>
39
+
<td>(<i>boolean</i>) defines whether a sub-row will take all the width of Grid, <i>false</i> by default</td>
40
+
</tr>
41
+
<tr>
42
+
<td><b>height</b></td>
43
+
<td>(<i>number</i>) the height of a sub-row in pixels, <i>200</i> by default</td>
44
+
</tr>
45
+
<tr>
46
+
<td><b>padding</b></td>
47
+
<td>(<i>string | number</i>) the inner padding of a sub-row, <i>8</i> by default</td>
48
+
</tr>
49
+
<tr>
50
+
<td><b>preserve</b></td>
51
+
<td>(<i>boolean</i>) saves the state of sub-rows while expanding/collapsing, disappearing from the visible area, data updating, <i>false</i> by default</td>
52
+
</tr>
53
+
<tr>
54
+
<td><b>toggleIcon</b></td>
55
+
<td>(<i>boolean</i>) enables the icon for expanding/collapsing, <i>true</i> by default</td>
56
+
</tr>
57
+
<tr>
58
+
<td><b>view</b></td>
59
+
<td>(<i>string | object | null</i>) that can be presented by:<ul><li>a <i>string</i>, if the sub-row is set by the HTML content</li><li>an <i>object</i> instance to interact with, if a sub-row is an instance of a nested component (for example, Grid)</li><li><i>null</i>, if the sub-row is unavailable (for example, it is hidden or placed outside the visible area and the `preserve` config is not specified)</li></ul></td>
60
+
</tr>
61
+
</tbody>
62
+
</table>
28
63
29
64
**Related article:**[Getting sub-row config and content](grid/configuration.md#getting-sub-row-config-and-content)
Copy file name to clipboardExpand all lines: docs/grid/api/grid_subrow_config.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Note that when the `subRow` config is used, Grid doesn't support the [TreeGrid m
18
18
19
19
## Parameters
20
20
21
-
The `subRow` property is a callback function which is called with the row object as a parameter and returns an HTML string or a constructor of a subGrid (or any other nested Suite component).
21
+
The `subRow` property is a callback function which is called with the row object as a parameter and returns HTML as string or a constructor of a subGrid (or any other nested Suite component).
22
22
23
23
### Example
24
24
@@ -38,7 +38,7 @@ const grid = new dhx.Grid("grid_container", {
Copy file name to clipboardExpand all lines: docs/grid/api/grid_subrowconfig_config.md
+19-11Lines changed: 19 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,8 +23,8 @@ The `subRowConfig` object may contain the following properties:
23
23
-`expanded` - (*boolean*) defines whether a sub-row is expanded by default, *false* by default
24
24
-`preserve` - (*boolean*) saves the state of sub-rows while expanding/collapsing, disappearing from the visible area, data updating, *false* by default
25
25
-`toggleIcon` - (*boolean*) enables the icon for expanding/collapsing, *true* by default
26
-
-`height` - (*number*) the height of a sub-row in pixels, *200* by default
27
-
-`padding` - (*string|number*) the inner padding of a sub-row, *8* by default
26
+
-`height` - (*number*) the height of a sub-row in pixels, [controls the visibility of sub-rows](grid/configuration.md#adding-sub-rows-for-specific-rows), *200* by default
27
+
-`padding` - (*string* | *number*) the inner padding of a sub-row, *8* by default
28
28
-`css` - (*string*) user-defined CSS classes for a sub-row
29
29
-`fullWidth` - (*boolean*) defines whether a sub-row will take all the width of Grid, *false* by default
30
30
@@ -54,23 +54,31 @@ const grid = new dhx.Grid("grid_container", {
54
54
55
55
- configuring sub-rows settings dynamically
56
56
57
-
~~~jsx {7-11}
57
+
The `height` setting of the `subRowConfig` property (set as a callback function) allows you to control the visibility of sub-rows. Set the `height` setting to 0 if you don't want a sub-row to be created for particular rows.
Copy file name to clipboardExpand all lines: docs/grid/configuration.md
+78-34Lines changed: 78 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1620,15 +1620,15 @@ const grid = new dhx.Grid("grid_container", {
1620
1620
1621
1621
## Row expander
1622
1622
1623
-
The row expander functionality allows using nested content in Grid sub-rows. You can add a Grid or any other Suite widget, as well as some HTML content into a sub-row. The number of Grid nesting levels is unlimited.
1623
+
The row expander functionality allows using nested content in Grid sub-rows. You can add a Grid or any other Suite widget, as well as some HTML content into a sub-row.
1624
1624
1625
1625
:::tip Pro version only
1626
1626
This functionality requires PRO version of the DHTMLXGrid (or DHTMLX Suite) package.
1627
1627
:::
1628
1628
1629
1629
### Adding sub-rows
1630
1630
1631
-
In order to enable the row expander feature, you should use the [`subRow`](grid/api/grid_subrow_config.md) configuration option. It defines the content of sub-rows for each row of the Grid. The`subRow` property is a callback function which is called with the row object as a parameter and returns an HTML string or the constructor of a subGrid (oranyothernestedSuitecomponent).
1631
+
In order to enable the row expander feature, you should use the [`subRow`](grid/api/grid_subrow_config.md) configuration option. It defines the content of sub-rows for each row of the Grid. The`subRow` property is a callback function which is called with the row object as a parameter and should return an HTML string or the constructor of a Suite component (Grid, Chart, Form, DataView, etc.).
1632
1632
1633
1633
:::note
1634
1634
Note that when the `subRow` config is used, Grid doesn't support the [TreeGrid mode](grid/treegrid_mode.md) and the [data grouping](grid/usage.md#grouping-data) functionality.
@@ -1650,7 +1650,7 @@ const grid = new dhx.Grid("grid_container", {
1650
1650
});
1651
1651
~~~
1652
1652
1653
-
In the example below a sub-row contains a subGrid:
1653
+
In the example below a sub-row contains a subgrid:
1654
1654
1655
1655
~~~jsx {7-16}
1656
1656
constgrid=newdhx.Grid("grid_container", {
@@ -1739,40 +1739,47 @@ const grid = new dhx.Grid("grid_container", {
1739
1739
1740
1740
In the above example the sub-rows are dynamically configured depending on the value in the column with the "temperature" id. If the temperature value is more than 30, a sub-row will be expanded and gets the CSS "hot-zone" class (or "cool-zone", if the temperature value is less than 30). The height of an expanded sub-row cell will be 200px.
1741
1741
1742
-
In the following example the [`subRowConfig`](grid/api/grid_subrowconfig_config.md) config set as a callback function defines that the rows that have the "Critical" status in the column with the "health_status" id will be expanded on initialization of the Grid. The height of an expanded sub-row cell will be 250px.
1742
+
#### Adding sub-rows for specific rows
1743
1743
1744
-
~~~jsx {5-8}
1744
+
You can define which row a sub-row should be created for with the help of the `height` property of the [`subRowConfig`](grid/api/grid_subrowconfig_config.md) configuration option. If you don't want to create sub-rows for particular rows, specify the `height:0` setting in the `subRowConfig` property.
1745
+
1746
+
:::note
1747
+
The described functionality works only if the `subRowConfig` property is initialized as a callback function.
**Related sample:** [Grid. Rowexpander. Subgridwith rows expanded by criteria](https://snippet.dhtmlx.com/pbubj175)
1770
+
In the above example the [`subRowConfig`](grid/api/grid_subrowconfig_config.md) config set as a callback function defines that sub-rows with the height 250px will be created for rows that have some data. For rows without data the `height:0` setting is specified, so sub-rows won't be created for these rows.
1771
+
1772
+
**Related sample:** [Grid. Row expander. Subgrid only in specific rows](https://snippet.dhtmlx.com/03udbtmr)
1768
1773
1769
1774
### Savingstateofnestedcomponentsordatainsub-rows
1770
1775
1771
1776
Youcansavethestateofthenestedcomponentsorthedataofsub-rowswhileupdatingdata, scrollingorcollapsingsub-rowsbyusingthe`preserve`propertyofthe [`subRowConfig`](grid/api/grid_subrowconfig_config.md) configurationoptionofGrid. Bydefault, sub-rowsaredestroyedwhentheyarehidden (e.g. if a row leaves the visible area during scrolling) orcollapsed, whichleadstoresettingofanychangesmadeintheinnercomponents.
1772
1777
1773
-
When the `preserve: true` setting is specified, sub-rows save their content even after being destroyed or hidden. It means that any change (such as sorting, data input or state change) is saved and the sub-row is restored in the same state when displayed again.
1778
+
Whenthe`preserve: true`settingisspecified, sub-rowsaren't destroyed when hidden or collapsed and their content is saved. It means that any change (such as sorting, data input or state change) is saved and the sub-row is restored in the same state when displayed again.
1774
1779
1775
-
However, it's important to take into account that this option increases the size of the used memory, since the sub-rows data are kept in the memory even when they aren't displayed.
- is called with an array of data that should be placed in the sub-row as a parameter
1910
-
- returns a subGrid that contains the `subRow` config set as a callback function that may return:
1916
+
- returns a nested Grid that contains the `subRow` config set as a callback function that may return:
1911
1917
- some Suite component
1912
-
- an HTML string
1913
-
- a subGrid instance for another nesting level (that contains the `subRow` config set as a callback function to return another subGrid, Suite component, or HTML content)
1918
+
- HTML as string
1919
+
- a subgrid instance for another nesting level (thatcontainsthe`subRow`configsetasacallbackfunction to return another subgrid, a Suite component, or HTML content)
1914
1920
1915
1921
Check the example below:
1916
1922
@@ -1964,6 +1970,10 @@ const grid = new dhx.Grid("grid_container", {
1964
1970
1965
1971
You can adjust the sub-row width depending on the width of its parent Grid via the `fullWidth` property of the [`subRowConfig`](grid/api/grid_subrowconfig_config.md) configuration object.
1966
1972
1973
+
:::info note
1974
+
The `fullWidth` property works only if the `subRowConfig` property is initialized as an object.
1975
+
:::
1976
+
1967
1977
If the `fullWidth: true` configuration option is specified, the sub-row width is the same as the full width of the Grid content, including the area outside the visible area borders (it means that the sub-row will be scrolled together with the horizontal scroll). By default, a sub-row takes just the width of the visible Grid area.
1968
1978
1969
1979
Check the example below:
@@ -2000,14 +2010,48 @@ You can get the configuration settings applied to a sub-row and the content insi
2000
2010
Note that the method works if a sub-row is in the visible area or if the `preserve:true` property is specified in the `subRowConfig` object of the sub-row.
2001
2011
:::
2002
2012
2003
-
The method returns an object that includes:
2013
+
The method takes as a parameter the id of a row and returns an object that includes the following properties:
2004
2014
2005
-
- the configuration of the sub-row, including both user-defined settings and the default settings (`expanded`, `fullWidth`, `padding`, `height`, `toggleItem`, `preserve`, `css`)
2006
-
-`element: HTMLElement | null`- the parent container of the current sub-row
2007
-
-`view: string | object | null`:
2008
-
- a *string*, if the sub-row is set by the HTML content
2009
-
- an object instance you can interact with, if a sub-row is an instance of a nested component (for example, Grid)
2010
-
-*null*, if the sub-row is unavailable (for example, it is hidden or placed outside the visible area and the `preserve` config is not specified)
2015
+
<table>
2016
+
<tbody>
2017
+
<tr>
2018
+
<td><b>css</b></td>
2019
+
<td>(<i>string</i>) user-defined CSS classes for a sub-row</td>
2020
+
</tr>
2021
+
<tr>
2022
+
<td><b>element</b></td>
2023
+
<td>(<i>HTMLElement | null</i>) the parent container of the current sub-row</td>
2024
+
</tr>
2025
+
<tr>
2026
+
<td><b>expanded</b></td>
2027
+
<td>(<i>boolean</i>) defines whether a sub-row is expanded by default, <i>false</i> by default</td>
2028
+
</tr>
2029
+
<tr>
2030
+
<td><b>fullWidth</b></td>
2031
+
<td>(<i>boolean</i>) defines whether a sub-row will take all the width of Grid, <i>false</i> by default</td>
2032
+
</tr>
2033
+
<tr>
2034
+
<td><b>height</b></td>
2035
+
<td>(<i>number</i>) the height of a sub-row in pixels, <i>200</i> by default</td>
2036
+
</tr>
2037
+
<tr>
2038
+
<td><b>padding</b></td>
2039
+
<td>(<i>string | number</i>) the inner padding of a sub-row, <i>8</i> by default</td>
2040
+
</tr>
2041
+
<tr>
2042
+
<td><b>preserve</b></td>
2043
+
<td>(<i>boolean</i>) saves the state of sub-rows while expanding/collapsing, disappearing from the visible area, data updating, <i>false</i> by default</td>
2044
+
</tr>
2045
+
<tr>
2046
+
<td><b>toggleIcon</b></td>
2047
+
<td>(<i>boolean</i>) enables the icon for expanding/collapsing, <i>true</i> by default</td>
2048
+
</tr>
2049
+
<tr>
2050
+
<td><b>view</b></td>
2051
+
<td>(<i>string | object | null</i>) that can be presented by:<ul><li>a <i>string</i>, if the sub-row is set by the HTML content</li><li>an <i>object</i> instance to interact with, if a sub-row is an instance of a nested component (for example, Grid)</li><li><i>null</i>, if the sub-row is unavailable (for example, it is hidden or placed outside the visible area and the `preserve` config is not specified)</li></ul></td>
0 commit comments