Checkboxes getting unselected on pagination

Hi team,


I have a requirement to have select checkboxes. I am binding that to a boolean variable in list variable.

But the issue is, on pagination, search, sort etc, the selection is lost. I tried a workaround of binding it to a different permanent list. But its causing performance issues. Any suggestion if I can implement this without loops and additional list variables.



Thanks

Well, 

euh no, I'm assuming that you are not storing the selections in the database?  So naturally, at the moment of pagination, search, sort, a new query is run on the database.  And if for example you have implemented the extra boolean as a calculated field on your aggregate, maybe returning false at moment aggregate runs, it will uncheck all your check boxes.

What is the ultimate goal of your selections, what are you going to do with the selected items ?  Is this something you can already do to them every time before doing a pagination or sort or search, or don't you want that ?


So when you say it's causing performance issues, can you elaborate, are you sure that it is due to the extra list manipulations ?  How many list items do you show on one page, how much information does a single row have? Are there maybe pictures in it?

You don't really need to bind to a local list and move aggregate result to that local list every time, all you need to do is keep track in a local list of the selected rows (by something unique, preferably just an id)  Every time a selection is changed, you update that local list, the aggregate returns all false values in the IsSelected column, and in the onAfterFetch of the aggregate, you go through the aggregate result once, and if the id is in the local list, you change IsSelected to True.  Can't imagine that being a performance problem.

Dorine

Made you a quick example of what I mean

Good Luck

Dorine Boudry wrote:

Made you a quick example of what I mean

Good Luck

 

 Hey Dorine,


Thanks for your quick response. Well I see you have used on after fetch event to retrieve the selections. I am working on Traditional web app. Can you provide a sample in Traditional as well?


Thanks

Solution

Hi Angel,


in traditional, after initial aggregate call and after each refresh of the aggregate, you can just do the logic that is now in the onAfterFetch right there in the flow after the aggregate call or aggregate refresh.

It's a bit messier in Tradional though, as when populating the IsSelected in the aggregate result, you can work on the aggregate result list, but when reacting to the user (de)selecting one, you have to look at the widget list.


See oml,

Dorine


Solution

I see what is wrong

I had copied the logic over from the reactive example, but for the listindex, it was looking at the wrong list

fixed :


Dorine

Dorine Boudry wrote:

euh, not sure what you mean...  deselecting is just changing the checkbox value for a given row from True to False, right ?  

So the index you talk about is from the ListIndexOf at top of MaintainLocalListOfSelectedIds ? If it was selected, it will at the beginning of this action still be in the local list of id's, right.  

And as it is being deselected in the table, it will take the False branch to the left, an as it is still currently in the local list, it will go down the True branch to the ListRemove.

Or is this not what you are referring to ?

Dorine

 Hi Dorine, in ListIndexOf, I think you were passing list not table by mistake. However that is fine. What about if I need to have select all from some link?

 

Angel Saxena wrote:

Dorine Boudry wrote:

euh, not sure what you mean...  deselecting is just changing the checkbox value for a given row from True to False, right ?  

So the index you talk about is from the ListIndexOf at top of MaintainLocalListOfSelectedIds ? If it was selected, it will at the beginning of this action still be in the local list of id's, right.  

And as it is being deselected in the table, it will take the False branch to the left, an as it is still currently in the local list, it will go down the True branch to the ListRemove.

Or is this not what you are referring to ?

Dorine

 Hi Dorine, in ListIndexOf, I think you were passing list not table by mistake. However that is fine. What about if I need to have select all from some link?

 

 Yes correct, i just saw that too.

what do you mean with that last question ?

 

Dorine Boudry wrote:

Angel Saxena wrote:

Dorine Boudry wrote:

euh, not sure what you mean...  deselecting is just changing the checkbox value for a given row from True to False, right ?  

So the index you talk about is from the ListIndexOf at top of MaintainLocalListOfSelectedIds ? If it was selected, it will at the beginning of this action still be in the local list of id's, right.  

And as it is being deselected in the table, it will take the False branch to the left, an as it is still currently in the local list, it will go down the True branch to the ListRemove.

Or is this not what you are referring to ?

Dorine

 Hi Dorine, in ListIndexOf, I think you were passing list not table by mistake. However that is fine. What about if I need to have select all from some link?

 

 Yes correct, i just saw that too.

what do you mean with that last question ?

 

 I have a select all link. On clicking that all records should be selected. Can this be done without using loops? Similary I need to cater deselect feature.

 

Hi Angel,

Don't know about 'without looping'.  There are, i think, examples and forge component available, maybe google outsystems bulk select and see how they do it.

Good luck

Dorine Boudry wrote:

Hi Angel,

Don't know about 'without looping'.  There are, i think, examples and forge component available, maybe google outsystems bulk select and see how they do it.

Good luck

 Ok Dorine.


Thanks a lot for all your help and suggestions. Helped me a lot.