blockSelectionValidate
pro version only
This functionality requires PRO version of the DHTMLX Grid (or DHTMLX Suite) package.
triggered to check the possibility of starting a selection
Usage
blockSelectionValidate: (
validateCell: { row: object; column: object },
handle: boolean,
event: MouseEvent | TouchEvent
) => boolean | void;
Parameters:
The callback of the event is called with the following parameters:
validateCell | (object) an object that contains the cell where the selection starts, includes the following properties:
|
handle | (boolean) indicates whether the handle is used (true ) or a regular selection (false ) |
event | (Event) the browser event: MouseEvent or TouchEvent |
Returns:
Return false
to cancel the action; otherwise, true
.
Example
const grid = new dhx.Grid("grid_container", {
columns: [
{ id: "a", header: [{ text: "A" }] },
{ id: "b", header: [{ text: "B" }] },
],
data: [
{ id: "1", a: "A1", b: "B1" },
{ id: "2", a: "A2", b: "B2" },
],
blockSelection: true
});
grid.block.events.on("blockSelectionValidate", (validateCell, handle, event) => {
if (cell.column.id === "b") {
console.log("Selection cannot start from column B");
return false;
}
});
Change log:
added in v9.2