Hey everyone
I'm trying to select rows programatically with the use of the new feature in the latest release of the Datagrid Component.But the main functionallity that should come with the feature is actually disabled. This doesn't make much sense right?
Hi @AndreRocha,
Thank you for your report. We've created a task in our backlog to investigate and add this use case. Refer to the code ROU-4320 in future release notes.
As a workaround you can use some custom code to cover this case:
let grid = OutSystems.GridAPI.GridManager.GetGridById($parameters.GridId)
let rowNumberList = JSON.parse($parameters.RowNumbers)
if (grid.features.rowHeader.hasCheckbox) {
rowNumberList.forEach((index) => {
grid.features.selection.getMetadata(index).isChecked = $parameters.isSelected;
});
grid.provider.collectionView.refresh();
} else {
rowsIndex.forEach((index) => {
grid.provider.rows[index].isSelected = $parameters.isSelected;
}
Now you can use this Client Action the same way you would use the SetRowAsSelected.
I've attached an OML file with this fix implemented for better understanding.
Hope it helps,
Giuliana.
It worked as expected! Thank you so much!
Hi, @AndreRocha!
Just a correction on the code above, in the else statement it should be rowNumberList instead of rowsIndex:
Regards,
Hey @Giuliana Silva
I had to modify the code a bit either way for my use case, but everything worked out in the end.
Thank you very much again
Hi,
FYI, For anyone facing issue for the first record using above, please change the property "Serialize default values" of the JSON Serialize widget to Yes as for first row it is 0.
Thanks,
Reshma