function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pubali Banerjee 2Pubali Banerjee 2 

On applying pagination, when a data table is updated in the second page, the page refreshes to first page after save in lightning

Issue description:
My code is working properly when it comes to updating the datatable. Pagination also works fine. Issue is, every page i am displaying 50 records. Now if i go to my second page, update any record and save, the record is getting saved BUT the page is refreshing back to the first page. Is there any way that if any record from 2nd page is updated, after hitting save button, the page refreshes back to the same page and display the updated data instead of refreshing back to the main page.
User-added imageUser-added imageUser-added imageHTML:
Best Answer chosen by Pubali Banerjee 2
mukesh guptamukesh gupta
Hi Pubali,

page = 2;

Please put this.displayRecordPerPage(page)  where you are updating your record in code , thia method will call after your DML operation.

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh

All Answers

ankit bansalankit bansal
Hi Pubali,
You can call your this.displayRecordPerPage() with the page number as argument from your publicSaveFunction method after the call to refreshApex. Pass to this.displayRecordPerPage() the value of this.page
mukesh guptamukesh gupta
Hi Pubali,

page = 2;

Please put this.displayRecordPerPage(page)  where you are updating your record in code , thia method will call after your DML operation.

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh
This was selected as the best answer