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_blockselection_config.md
+92-33Lines changed: 92 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,7 @@ The `blockSelection` property can be set in two ways:
68
68
</tr>
69
69
<tr>
70
70
<td><b>mode</b></td>
71
-
<td>the operating mode of the module:<ul><li><i>"range"</i> - managed through the Range module</li><li><i>"manual"</i> - managed through the manual control</li></ul></td>
71
+
<td>the operating mode of the module:<ul><li><i>"range"</i> - managed through the <a href="../../usage_rangeselection/">`RangeSelection` module</a></li><li><i>"manual"</i> - managed through the manual control</li></ul></td>
72
72
</tr>
73
73
<tr>
74
74
<td><b>handle</b></td>
@@ -82,12 +82,12 @@ The `blockSelection` property can be set in two ways:
82
82
</table>
83
83
84
84
:::note
85
-
By default, the `blockSelection` property is set to `false`. When `blockSelection` is set to `true` or the module is set to the "range" mode, the **Range** module is initialized.
85
+
By default, the `blockSelection` property is set to `false`. When `blockSelection` is set to `true` or the module is set to the "range" mode, the [`RangeSelection`](grid/usage_rangeselection.md) module is initialized.
86
86
:::
87
87
88
+
This example demonstrates configuring the module with the handle disabled and the "range" mode enabled:
88
89
89
-
~~~jsx
90
-
// this example demonstrates configuring the module with the handle disabled and the "range" mode enabled
90
+
~~~jsx {10-13}
91
91
constgrid=newdhx.Grid("grid_container", {
92
92
columns: [
93
93
{ id:"a", header: [{ text:"A" }] },
@@ -98,46 +98,105 @@ const grid = new dhx.Grid("grid_container", {
98
98
{ id:"2", a:"A2", b:"B2" },
99
99
],
100
100
blockSelection: {
101
-
mode:"range",
102
-
handle:false,
101
+
mode:"range",// setting the "range" mode
102
+
handle:false// the handle is disabled
103
103
}
104
104
});
105
105
~~~
106
106
107
+
This example demonstrates configuring the handle and its behavior:
108
+
107
109
~~~jsx
108
-
// this example demonstrates configuring the handle and its behavior
110
+
/* Define grid columns configuration */
111
+
constcolumns= [
112
+
{ id:"productId", header: [{ text:"Product ID" }] }, // Column for the unique product identifier
113
+
{ id:"productName", header: [{ text:"Product Name" }] }, // Column for the product name
114
+
{ id:"category", header: [{ text:"Category" }] }, // Column for the product category
115
+
{ id:"receivedDate", header: [{ text:"Received Date" }], type:"date", dateFormat:"%d.%m.%Y" }, // Date column with the specified format
116
+
{ id:"stock", header: [{ text:"Stock" }], type:"number" }, // Numeric column for the stock quantity
117
+
{ id:"price", header: [{ text:"Price" }], type:"number", numberMask: { prefix:"$" } } // Numeric column for the price with the dollar prefix
118
+
];
119
+
120
+
/* Initialize DHTMLX Grid with the specified configuration */
109
121
constgrid=newdhx.Grid("grid_container", {
110
-
columns: [
111
-
{ id:"a", header: [{ text:"A" }] },
112
-
{ id:"b", header: [{ text:"B" }] },
113
-
],
114
-
data: [
115
-
{ id:"1", a:"A1", b:"B1" },
116
-
{ id:"2", a:"A2", b:"B2" },
117
-
],
122
+
columns,
123
+
data,
124
+
autoWidth:true,
125
+
history:true, // Enable history tracking for undo/redo
118
126
blockSelection: {
119
-
mode:"range",
120
127
handle: {
121
-
allowAxis:"x", // the handle movement is restricted by the "x" axis
122
-
handler: ({ array, range, grid, cell, index }) => {
123
-
if (array.length<=1) {
124
-
return;
125
-
}
126
-
constfirstCell= range[0];
127
-
// the copied cells will have the "-copied" suffix
0 commit comments