[Data Grid Reactive] Activate a page in the grid dynamically
Forge component by OutSystems R&D
Application Type


Is there a possibility to dynamically navigate to a specific page in the grid? 

Our use case is the following: suppose the grid has 3 pages and the user has navigated to page 2. The user clicks on an action column that opens a new screen. When the user navigates back to the screen with the grid on it, the grid should show page 2 instead of page 1.

I have tried if the action UpdateStartingRowHeader would do the trick, but it did not.

Alfio Esposito

Hey Alfio,

We don't have this as a client action, but we do have an API on our JS code that allows you to change pages.

GridAPI.Pagination.MoveToPage(gridID, pageNumber).

Please let me know if this method helps you.

Thank you Gabriel. This method helps.

Now I just need a way to retrieve what the current page number is. I searched the API in the JS code but I did not find a method. Did I miss it or is there another way?



Hi Alfio,

I've created the following Pull Request, to add a method to the API to return the current page number.

Meanwhile, if you're in a hurry, you can see the code that I've made, and create a client side action on your side that executes the following code:

if (!OSFramework.Helper.IsGridReady(gridID)) return -1; 
const grid = GridManager.GetGridById(gridID); 
const pageIndex = grid.features.pagination.pageIndex;

Let me know your thoughts or questions,

Thanks Ruben. I have for now created an client action on our side. It works for us for now.

I do have a follow-up question now that has to do with our use case. We have a grid with an action column. That action column leads to a new screen being opened. When the user navigates back from that screen, the grid should be re-opened on the same page as that it was before.

I tried adding the code to navigate to the "old" page in the OnInitialize of the grid, the OnReady of the page and also in the OnAfterFetch of the data action that retrieves the data. Unfortunately none of these places seem to do the trick. What would be the correct place to perform the navigation?


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