29
Views
7
Comments
[OutSystems Data Grid] Row Selection Problem After Grouping Data in Grid
outsystems-data-grid
Reactive icon
Forge asset by OutSystems

Hello everyone,

I'm facing an issue with row selection in a grid. For my requirement, I need to manage two local variables (Is_SelectAll_By_User , Is_SelectAll_By_Row) when selecting and deselecting the group checkbox in the grid's header. I implemented a script in the OnRender event of my screen, 
which was working fine initially.

However, when I group the data and select the group header checkbox, all records are checked, and similarly, all records are unchecked when I deselect it. The problem arises when I deselect an individual checkbox and then click the group header checkbox again; the checked data becomes mismatched. Specifically, I want to select only the unchecked data while ensuring that the previously selected records remain checked.

Here are the steps to reproduce the issue:

  1. Group any column.
  2. Select the "Select All" header checkbox.
  3. Deselect any one record.
  4. Click the "Select All" header checkbox again.

I would greatly appreciate any assistance in resolving this issue. Thank you!

2021-07-05 07-08-52
Kevin Busch

Not the solution for the problem, but another solution.

You can create a Structure with the name "Selectable" and the sturcture contains a Boolean Field called "selected".

In the Aggregate, where you get your Data, you can join the structure, so each entry has the variable "selected".

When you click on a SelectAll Button, you could iterate through each result of the Aggregate/DataAction and set the selected-Attribute to true / false.

2024-09-17 12-24-07
Rammurthy Naidu Boddu
Champion

In the aggregate, add one attribute named IsSelected by default false and if selected true by resolving your issue. 

2022-11-12 11-28-30
Gonçalo Martins
Staff

Hello @Dhineshkumar B 

To make this more efficient and collaborative for the community please share a sample OML where that issue can be reproduced. 
That way someone from the community can take a look without investing more time in implementing the use case.

Cheers,
GM

UserImage.jpg
Dhineshkumar B

Ok, sure. I have attached my OML below.

Test_Application_Select_All.oml
UserImage.jpg
Dhineshkumar B

Hi @Gonçalo Martins , could you please take a look at my OML file and assist me with resolve this issue?
I would really appreciate your help. Thank you! 

2022-11-12 11-28-30
Gonçalo Martins
Staff

Hi @Dhineshkumar B 

First of all, in my personal opinion, you should rethink the whole screen logic since it is impossible to maintain and has several performance issues.
Looking into the problem it seems to be in the screen action On_Render (which I would simply remove since it runs so many times that it is clearly a performance issue at scale).
Also, after deleting this client action the issue you reported stopped occurring.
Probably other scenarios will be broken because of that but the code is so complex that it is hard to help more so I suggest you start from there since the issue seems to be on the way you're getting the checkbox all from the group versus the checkbox all from the whole Grid.

Hope it helps.

Cheers,
GM

UserImage.jpg
Nino Gachechiladze

Do you change both local variables (Is_SelectAll_By_User , Is_SelectAll_By_Row)  accordingly  when selecting/unselecting single checkbox?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.