Skip to content

Commit db61955

Browse files
authored
Merge pull request #20 from DHTMLX/cols-rows-hiding-showing-4353
[add] hiding/showing cols/rows api, update related guides
2 parents 98b10f2 + 9958f2b commit db61955

17 files changed

+306
-26
lines changed

docs/api/api_overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Parameters:
4343
| [](api/spreadsheet_getsheets_method.md) | @getshort(api/spreadsheet_getsheets_method.md) |
4444
| [](api/spreadsheet_getstyle_method.md) | @getshort(api/spreadsheet_getstyle_method.md) |
4545
| [](api/spreadsheet_getvalue_method.md) | @getshort(api/spreadsheet_getvalue_method.md) |
46+
| [](api/spreadsheet_hidecols_method.md) | @getshort(api/spreadsheet_hidecols_method.md) |
47+
| [](api/spreadsheet_hiderows_method.md) | @getshort(api/spreadsheet_hiderows_method.md) |
4648
| [](api/spreadsheet_hidesearch_method.md) | @getshort(api/spreadsheet_hidesearch_method.md) |
4749
| [](api/spreadsheet_insertlink_method.md) | @getshort(api/spreadsheet_insertlink_method.md) |
4850
| [](api/spreadsheet_islocked_method.md) | @getshort(api/spreadsheet_islocked_method.md) |
@@ -60,6 +62,8 @@ Parameters:
6062
| [](api/spreadsheet_setstyle_method.md) | @getshort(api/spreadsheet_setstyle_method.md) |
6163
| [](api/spreadsheet_setvalidation_method.md) | @getshort(api/spreadsheet_setvalidation_method.md) |
6264
| [](api/spreadsheet_setvalue_method.md) | @getshort(api/spreadsheet_setvalue_method.md) |
65+
| [](api/spreadsheet_showcols_method.md) | @getshort(api/spreadsheet_showcols_method.md) |
66+
| [](api/spreadsheet_showrows_method.md) | @getshort(api/spreadsheet_showrows_method.md) |
6367
| [](api/spreadsheet_startedit_method.md) | @getshort(api/spreadsheet_startedit_method.md) |
6468
| [](api/spreadsheet_undo_method.md) | @getshort(api/spreadsheet_undo_method.md) |
6569
| [](api/spreadsheet_unfreezecols_method.md) | @getshort(api/spreadsheet_unfreezecols_method.md) |

docs/api/overview/actions_overview.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,13 @@ spreadsheet.events.on("beforeColumnAdd", function(cell){
7474
| **setValidation** | The action is executed when setting data validation for a cell |
7575
| **sortCells** | The action is executed when sorting data in spreadsheet |
7676
| **setCellStyle** | The action is executed when changing the style of a cell |
77-
| **toggleFreeze** | The action is executed when freezing/unfreezing columns/rows |
77+
| **toggleVisibility** | The action is executed when hiding/showing a column or a row |
78+
| **toggleFreeze** | The action is executed when freezing/unfreezing columns/rows |
7879
| **unmerge** | The action is executed when splitting cells |
7980

8081
**Change log:**
8182

82-
- The **toggleFreeze** action was added in v5.2
83+
- The **toggleFreeze** and **toggleVisibility** actions were added in v5.2
8384
- The **merge**, **unmerge**, **filter**, **fitColumn**, **insertLink** actions were added in v5.0
8485

8586
**Related sample:** [Spreadsheet. Actions](https://snippet.dhtmlx.com/efcuxlkt)

docs/api/overview/methods_overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ description: You can have a Methods overview of the DHTMLX JavaScript Spreadshee
2626
| [](../spreadsheet_getformula_method.md) | @getshort(../spreadsheet_getformula_method.md) |
2727
| [](../spreadsheet_getsheets_method.md) | @getshort(../spreadsheet_getsheets_method.md) |
2828
| [](../spreadsheet_getstyle_method.md) | @getshort(../spreadsheet_getstyle_method.md) |
29+
| [](../spreadsheet_hidecols_method.md) | @getshort(../spreadsheet_hidecols_method.md) |
30+
| [](../spreadsheet_hiderows_method.md) | @getshort(../spreadsheet_hiderows_method.md) |
2931
| [](../spreadsheet_hidesearch_method.md) | @getshort(../spreadsheet_hidesearch_method.md) |
3032
| [](../spreadsheet_getvalue_method.md) | @getshort(../spreadsheet_getvalue_method.md) |
3133
| [](../spreadsheet_insertlink_method.md) | @getshort(../spreadsheet_insertlink_method.md) |
@@ -44,6 +46,8 @@ description: You can have a Methods overview of the DHTMLX JavaScript Spreadshee
4446
| [](../spreadsheet_setstyle_method.md) | @getshort(../spreadsheet_setstyle_method.md) |
4547
| [](../spreadsheet_setvalidation_method.md) | @getshort(../spreadsheet_setvalidation_method.md) |
4648
| [](../spreadsheet_setvalue_method.md) | @getshort(../spreadsheet_setvalue_method.md) |
49+
| [](../spreadsheet_showcols_method.md) | @getshort(../spreadsheet_showcols_method.md) |
50+
| [](../spreadsheet_showrows_method.md) | @getshort(../spreadsheet_showrows_method.md) |
4751
| [](../spreadsheet_startedit_method.md) | @getshort(../spreadsheet_startedit_method.md) |
4852
| [](../spreadsheet_undo_method.md) | @getshort(../spreadsheet_undo_method.md) |
4953
| [](../spreadsheet_unfreezecols_method.md) | @getshort(../spreadsheet_unfreezecols_method.md) |
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
sidebar_label: hideCols()
3+
title: hideCols method
4+
description: You can learn about the hideCols method in the documentation of the DHTMLX JavaScript Spreadsheet library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Spreadsheet.
5+
---
6+
7+
# hideCols()
8+
9+
### Description
10+
11+
@short: Hides columns
12+
13+
### Usage
14+
15+
~~~jsx
16+
hideCols(cell?: string): void;
17+
~~~
18+
19+
### Parameters
20+
21+
- `cell` - (optional) the id of the cell used to define the id of a column. If the cell id isn't passed, the currently selected cell will be used
22+
23+
### Example
24+
25+
~~~jsx
26+
spreadsheet.hideCols("B2"); // the "B" column will be hidden
27+
spreadsheet.hideCols("sheet2!B2"); // the column "B" in "sheet2" will be hidden
28+
spreadsheet.hideCols("B2:C2"); // the "B" and "C" columns will be hidden
29+
~~~
30+
31+
32+
**Related article:** [Work with Spreadsheet](working_with_ssheet.md/#hidingshowing-rows-and-columns)
33+
34+
**Related API:** [`showCols()`](api/spreadsheet_showcols_method.md)
35+
36+
**Related sample:** [Spreadsheet. Hiding columns and rows via API](https://snippet.dhtmlx.com/zere1ote)
37+
38+
**Change log:** Added in v5.2
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
sidebar_label: hideRows()
3+
title: hideRows method
4+
description: You can learn about the hideRows method in the documentation of the DHTMLX JavaScript Spreadsheet library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Spreadsheet.
5+
---
6+
7+
# hideRows()
8+
9+
### Description
10+
11+
@short: Hides rows
12+
13+
### Usage
14+
15+
~~~jsx
16+
hideRows(cell?: string): void;
17+
~~~
18+
19+
### Parameters
20+
21+
- `cell` - (optional) the id of the cell used to define the id of a row. If the cell id isn't passed, the currently selected cell will be used
22+
23+
### Example
24+
25+
~~~jsx
26+
spreadsheet.hideRows("B2"); // the "2" row will be hidden
27+
spreadsheet.hideRows("sheet2!B2"); // the "2" row in "sheet2" will be hidden
28+
spreadsheet.hideRows("B2:C4"); // the rows from "2" to "4" will be hidden
29+
~~~
30+
31+
**Related article:** [Work with Spreadsheet](working_with_ssheet.md/#hidingshowing-rows-and-columns)
32+
33+
**Related API:** [`showRows()`](api/spreadsheet_showrows_method.md)
34+
35+
**Related sample:** [Spreadsheet. Hiding columns and rows via API](https://snippet.dhtmlx.com/zere1ote)
36+
37+
**Change log:** Added in v5.2

docs/api/spreadsheet_parse_method.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,20 @@ parse({
3939
{
4040
name?: string,
4141
id?: string,
42-
rows?: array,
43-
cols?: array,
42+
cols?: [
43+
{
44+
width?: number,
45+
hidden?: boolean,
46+
},
47+
// more column objects
48+
],
49+
rows?: [
50+
{
51+
height?: number,
52+
hidden?: boolean,
53+
},
54+
// more row objects
55+
],
4456
data: [
4557
{
4658
cell: string,
@@ -99,8 +111,12 @@ If you need to create a data set *for several sheets* at once, specify data as a
99111
- `sheets` - (required) an array of **sheet** objects. Each object has the following properties:
100112
- `name` - (optional) the sheet name
101113
- `id` - (optional) the sheet id
102-
- `rows` - (optional) an array of height objects. If not specified, the rows will have a height of 32px.
103-
- `cols` - (optional) an array of width objects. If not specified, the columns will have a width of 120px.
114+
- `rows` - (optional) an array of objects with rows configurations. Each object may contain the following properties:
115+
- `height` - (optional) the row height. If not specified, rows will have the height of 32px
116+
- `hidden` - (optional) defines the visibility of a row
117+
- `cols` - (optional) an array of objects with columns configurations. Each object may contain the following properties:
118+
- `width` - (optional) the column width. If not specified, columns will have the width of 120px
119+
- `hidden` - (optional) defines the visibility of a column
104120
- `data` - (required) an array of **cell** objects. Each object has the following properties:
105121
- `cell` - (required) the id of a cell that is formed as "id of the column + id of the row", e.g. A1
106122
- `value` - (required) the value of a cell
@@ -163,14 +179,14 @@ const data = {
163179
name: "sheet 1",
164180
id: "sheet_1",
165181
rows: [
166-
{ height: 50 }, // the height of the first row
167-
{ height: 50 }, // the height of the second row
168-
// the height of the other rows is 32
182+
{ height: 50, hidden: true }, // config of the first row
183+
{ height: 50 }, // config of the second row
184+
// the height of other rows is 32
169185
],
170186
cols: [
171-
{ width: 300 }, // the width of the first column
172-
{ width: 300 }, // the width of the second column
173-
// the width of the other columns is 120
187+
{ width: 300 }, // config of the first column
188+
{ width: 300, hidden: true }, // config of the second column
189+
// the width of other columns is 120
174190
],
175191
data: [
176192
{ cell: "A1", value: "Country" },
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
sidebar_label: showCols()
3+
title: showCols method
4+
description: You can learn about the showCols method in the documentation of the DHTMLX JavaScript Spreadsheet library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Spreadsheet.
5+
---
6+
7+
# showCols()
8+
9+
### Description
10+
11+
@short: Shows hidden columns
12+
13+
### Usage
14+
15+
~~~jsx
16+
showCols( cell?: string): void;
17+
~~~
18+
19+
### Parameters
20+
21+
- `cell` - (optional) the id of the cell used to define the id of a column. If the cell id isn't passed, the currently selected cell will be used
22+
23+
### Example
24+
25+
~~~jsx
26+
spreadsheet.showCols("B2"); // the "B" column will become visible again
27+
spreadsheet.showCols("sheet2!B2"); // the column "B" in "sheet2" will become visible again
28+
spreadsheet.showCols("B2:C2"); // the "B" and "C" columns will become visible again
29+
~~~
30+
31+
**Related article:** [Work with Spreadsheet](working_with_ssheet.md/#hidingshowing-rows-and-columns)
32+
33+
**Related API:** [`hideCols()`](api/spreadsheet_hidecols_method.md)
34+
35+
**Related sample:** [Spreadsheet. Hiding columns and rows via API](https://snippet.dhtmlx.com/zere1ote)
36+
37+
**Change log:** Added in v5.2
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
sidebar_label: showRows()
3+
title: showRows method
4+
description: You can learn about the showRows method in the documentation of the DHTMLX JavaScript Spreadsheet library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Spreadsheet.
5+
---
6+
7+
# showRows()
8+
9+
### Description
10+
11+
@short: Shows hidden rows
12+
13+
### Usage
14+
15+
~~~jsx
16+
showRows(cell?: string): void;
17+
~~~
18+
19+
### Parameters
20+
21+
- `cell` - (optional) the id of the cell used to define the id of a row. If the cell id isn't passed, the currently selected cell will be used
22+
23+
### Example
24+
25+
~~~jsx
26+
spreadsheet.showRows("B2"); // the "2" row will become visible again
27+
spreadsheet.showRows("sheet2!B2"); // the "2" row in "sheet2" will become visible again
28+
spreadsheet.showRows("B2:C2"); // the rows from "2" to "4" will become visible again
29+
~~~
30+
31+
**Related article:** [Work with Spreadsheet](working_with_ssheet.md/#hidingshowing-rows-and-columns)
32+
33+
**Related API:** [`hideRows()`](api/spreadsheet_hiderows_method.md)
34+
35+
**Related sample:** [Spreadsheet. Hiding columns and rows via API](https://snippet.dhtmlx.com/zere1ote)
36+
37+
**Change log:** Added in v5.2
42.1 KB
Loading

docs/assets/hide_columns_toolbar.png

42 KB
Loading

0 commit comments

Comments
 (0)