149
Views
7
Comments
How can we keep Selected data while pagination,when we are receiving it from SP
Application Type
Reactive
Service Studio Version
11.54.41 (Build 63060)

When i selected a row on the First page and moving to next page and again if i am coming back to first page the selected row gone.I am not able to keep selected  row while doing pagination.The data which i am showing is coming from Stored Procedure.

2023-10-27 15-22-44
Rahul Yadav

Hi Sarthak,

I have built a simple demo for your use case and attaching an oml for the same. 

You can access it on the below url - 

https://personal-cscpmcir.outsystemscloud.com/TestFeature/PaginationDemo

I have assumed that the stored procedure getting used would have a field for selection. If there is any deviation do let me know I can work out that change. 

Thanks

Rahul Yadav

TestFeature.oml
2024-07-12 05-57-50
Gourav Shrivastava
Champion

Hello @Rahul Yadav ,

It is failing while deselecting the row.

Step to reproduce:- 

1) select three rows on the first page then go to the second page and select three again.

2) come to the first page and deselect anyone and go to the next page and come again on the first page.

It shows selected 



Thanks 

Regards Gourav Shrivastava

2023-10-27 15-22-44
Rahul Yadav

Thanks Gourav for pointing out. I have fixed it now. 


TestFeature.oml
2023-12-16 19-57-03
Sanjay Kushwah

Hi sarthak singh,

Using Client/Local variable you can preserved the selected row Id into a client/local variable and on after fetch of aggregate or dataaction again check then selected row id and make that row selected again.

Attaching OML file for your refrence.

I don't know how you are exactly calling your procedure (by dataaction or onclick of button getting output from a server action) to get data on screen 

if you are using Stored procedure then probably using Dataaction to run SQL you need to check preserved the selected row Id on afterfetch of the dataAction.

Thanks,

Sanjay Kushwah

Test.oml
2026-02-06 06-25-47
Mohan Sigamani

Hi  sarthak, 

       You need a bulk selection and it should retain while doing pagination right?

        Solution: In the below link, it is explained clearly. Check it.

        https://medium.com/disrupting-outsystems/bulk-select-the-right-way-in-outsystems-cc7933f6be07

        Hope it helps.

Regards

Mohan

2024-10-03 23-27-42
Aleff Francisco Correia

Hello; 

I would create an id list that stores the id of all selected items.

2023-05-30 10-05-13
Lourenço Matalonga

Hello @Sarthak Singh ,

In OutSystems Reactive applications, to maintain state such as selected rows across paginations, you can use client variables or local storage to store the state of the selected items. When the data is fetched from a Stored Procedure (SP), it's especially important to handle the state on the client side because the SP will not maintain the state for you.

Here's a general approach to keep track of selected rows across pagination:

  • Create a Local Variable: Define a local variable (usually a list) in your screen to keep track of selected rows. The type of this list should correspond to the identifier of the rows you are selecting.
  • Select and Store State: When a row is selected, add/remove the identifier of this row to/from the local list variable. This could be done using a checkbox or any other selection mechanism, which will trigger an event to update this list.
  • Persist Selections Across Pages: Since you're moving between pages, you need to make sure the local list variable's state persists. You can do this in a couple of ways:
  • Use client variables to temporarily store the selected items.
  • Utilize the browser's local storage or session storage to keep the state.
  • Restore State on Page Load: On the OnInitialize or OnRender events of the screen, check the client variable or local storage for any selected items. If there are any, use these to set the selected state of the corresponding rows.
  • Update the UI: In your Table Records widget, you will need to have a way to bind the selected state to each row. You can do this by comparing each row's identifier with the list of selected identifiers and setting the selection accordingly.

This approach should fix your problem if I understood your problem correctly.


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