Skip to content

Commit 883aa82

Browse files
committed
[add] the delete shortcut key description for grid
1 parent f9641ab commit 883aa82

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

docs/grid/configuration.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,6 +2444,10 @@ The list of the shortcut keys for editing:
24442444
<td><b>Escape</b></td>
24452445
<td>close the editor of the selected cell without saving</td>
24462446
</tr>
2447+
<tr>
2448+
<td><b>Delete</b></td>
2449+
<td>clears the data in the selected cells. Works only with the <a href="../usage_blockselection/#keyboard-navigation">`BlockSelection` module</a> in the "range" mode</td>
2450+
</tr>
24472451
</tbody>
24482452
</table>
24492453

docs/grid/usage_blockselection.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,41 @@ The main points of cell selection while using the `BlockSelection` module are gi
119119

120120
### Keyboard navigation
121121

122-
The module supports keyboard navigation for selecting and managing ranges, similar to keyboard navigation used in Google Spreadsheets:
122+
:::note
123+
Keyboard navigation works in both the `"range"` and `"manual"` modes. In the `"manual"` mode, applying the selection (e.g., after `Enter`) requires handling via the events, such as [`beforeBlockSelectionApply`](grid/api/blockselection/beforeblockselectionapply_event.md) and [`afterBlockSelectionApply`](grid/api/blockselection/afterblockselectionapply_event.md).
124+
:::
125+
126+
- The module supports keyboard navigation for selecting and managing ranges, similar to keyboard navigation used in Google Spreadsheets:
123127
- **Arrows** (`ArrowUp`, `ArrowDown`, `ArrowLeft`, `ArrowRight`): moves the focus to the adjacent cell, setting the initially selected cell if no selection is active.
124128
- **Shift + Arrows**: extends the selected range from the current initial cell in the direction of the pressed arrow.
125129
- **Ctrl + Arrows**: extends the selected range to the last cell in the direction of the pressed arrow.
126130

127-
The **Shift + click** combination is also available. It sets the end cell of the range, extending the selection from the current initial cell.
131+
- The **Shift + click** combination sets the end cell of the range, extending the selection from the current initial cell.
128132

129-
Keyboard navigation works in both the `"range"` and `"manual"` modes. In the `"manual"` mode, applying the selection (e.g., after `Enter`) requires handling via the events, such as [`beforeBlockSelectionApply`](grid/api/blockselection/beforeblockselectionapply_event.md) and [`afterBlockSelectionApply`](grid/api/blockselection/afterblockselectionapply_event.md).
133+
- The **Delete** shortcut key allows clearing the selected cells when the [`editable` mode](grid/api/grid_editable_config.md) is set for the Grid component and the `BlockSelection` module is used in the `"range"` mode.
134+
It is possible to cancel the cells clearing by using the [`beforeKeyDown`](grid/api/grid_beforekeydown_event.md) event:
135+
136+
~~~jsx
137+
const grid = new dhx.Grid("grid_container", {
138+
columns: [
139+
{ id: "country", header: [{ text: "Country" }] },
140+
// The data of the cells in the "population" column will not be cleared
141+
{ id: "population", header: [{ text: "Population" }], editable: false },
142+
{ id: "yearlyChange", header: [{ text: "Yearly Change" }] },
143+
],
144+
blockSelection: {
145+
mode: "range"
146+
},
147+
editable: true,
148+
// other configuration
149+
});
150+
151+
grid.events.on("beforeKeyDown", (event) => {
152+
if (event.key === "Delete") {
153+
return false; // cancel clearing all selected cells
154+
}
155+
});
156+
~~~
130157

131158
### Selection handle
132159

docs/whatsnew.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ Released on June X, 2025
5454
- Grid. The issue with falsy selection of frozen cells while selecting unfrozen cells
5555
- Grid. The issue with dragging unselected items
5656
- Grid. Sorting of the Date string (ISO) values results in the invalid format error
57-
- Grid. The issue with displaying of the TreeMap with groups
5857

5958
### New samples
6059

0 commit comments

Comments
 (0)