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:
I would greatly appreciate any assistance in resolving this issue. Thank you!
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.
In the aggregate, add one attribute named IsSelected by default false and if selected true by resolving your issue.
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
Ok, sure. I have attached my OML below.
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!
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.
Do you change both local variables (Is_SelectAll_By_User , Is_SelectAll_By_Row) accordingly when selecting/unselecting single checkbox?