Please refer to https://docs.dhtmlx.com/suite/grid/api/selection/selection_getcells_method/,
I have the same problem. The .getCell() works, while .getCells() not. This occurs in the grid’s “afterSelect” event right after the .parse(data) and grid.selection.setCell(row).
Unfortunately, I was not able to reconstruct your issue locally.
Please, make sure that you’ve enabled the multiSelection mode for your grid.
If the problem still occurs for you please, provide a snippet, where the problem could be reconstructed.
You can create a snippet here:
https://snippet.dhtmlx.com/92cffle2
Hi sematik.
Please replace the createGrid() with the following codes in the above link.
function createGrid() {
if (grid) {
grid.destructor();
}
grid = new dhx.Grid("grid", config);
grid.data.parse(dataset);
grid.events.on("AfterSelect", function (row, col) {
alert(grid.selection.getCells().length);
alert(grid.selection.getCell().row.country);
});
}
Please, try to use the awaitRedraw helper to perform the code after the component’s rendering:
https://docs.dhtmlx.com/suite/helpers/await_redraw/
Something like:
grid.events.on("AfterSelect", function (row, col) {
dhx.awaitRedraw().then(function() {
alert(grid.selection.getCells().length);
alert(grid.selection.getCell().row.country);
})
});