42
Views
2
Comments
GetRowData on other pages
Question

Hi there, i'm using the DataGrid api GetRowData to fetch row's data by its number, but it seems that this api won't work with rows on other pages than the current view.
How can I fetch row's data on other pages?

Thanks,

Giovanni.

UserImage.jpg
Ankur Manekar

Hi,

Suppose you consumed REST API in your application then you must have to create one server action to get response, Server action should be public the you can use this server action in other module by manage dependance.

Thanks 

2021-11-12 04-59-31
Manikandan Sambasivam

To fetch row data from pages other than the current view in a DataGrid in OutSystems, you need to work with the DataGrid component's pagination and data retrieval functionalities. The GetRowData API function indeed only works with the currently visible rows, so you'll need a different approach to access data from other pages.

Approach 1: Load All Data at Once

If the dataset is not too large, you can load all data at once and manage pagination manually within the application logic. This way, you have access to all rows regardless of the current page.

  1. Load All Data: Retrieve the entire dataset from the database in a single query.
  2. Store Data in a Local Variable: Store the complete dataset in a local variable or aggregate.
  3. Implement Custom Pagination: Use a custom pagination mechanism to display subsets of the data in the DataGrid, based on the current page.

Approach 2: Server-side Pagination

If loading all data at once is not feasible due to performance considerations, use server-side pagination:

  1. Retrieve Data for Specific Page: Implement a server-side function to fetch data for a specific page based on the page number and page size.
  2. Expose Server Action: Expose this server action to the client side to allow fetching data for any page.
  3. Fetch Data on Demand: When you need data from a different page, call this server action to fetch the required data.
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.