how to update editable table records with pagination
Question
Application Type
Reactive

Hi,

i have created editable table.

i want to update records where user enters or changes values .

if user updates one record from one page & another one record from second or next page, that value has to be updated.

when i go to next page then value which is entered on previous page is getting refreshed.


so, how i can update records which are from different pages?


Thanks in advance!

Hi Shital,

If it is in line with your business case, you can just update the value entered by the user in the OnChange event of the textbox. This way, the value you want is updated in DB as soon as user changes the value, so that it wouldn't get lost when going to another page. 

Another way would be not to refresh the data source when pagination changes.

So, instead of getting the records with a Start and a Limit (MaxRecords) via Aggregate/Data Action, you would get everything at once, assign them to a list record variable, and use that variable as the source of your table.

You can still apply pagination to that list, so you don't have to show the whole list at once. The values changed by the user would stay in the list record, and you would update the changes together at once when user clicks an 'Update' button in the screen.

You can check out this component on List Pagination: https://www.outsystems.com/forge/component-overview/7700/list-pagination-reactive

This second method has some disadvantages: The performance can suffer if there are a lot of records to get at once. You would also need a more intelligent way of only saving the changed values in the last step, instead of running a CreateUpdate action for each of the records, to improve performance.

Hi Ozan,

thanks for ur reply!

first one method is working by using aggregate.

do i need to again call CreateOrUpdate action on Save button?


I have tried with second method as well with list variable. 

same thing i have done as given in First method.



Hi Shital,

Indeed, if you set a new client action to the 'OnChange' event of the textbox, it will get triggered when the value is changed by the user. There you need to call the CreateOrUpdate action of the entity to save the change into the database.

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