[Urgent] Pagination reset to first page after data updated

Here's my code


Component:

public async getDataTable() {
    await this.detail.execute({
      skip: 0,
      take: 10,
      action: {
        currentPage: 1,
      },
    });
  }

  public async getDataTablesStateExchange(state: DataStateChangeEventArgs) {
    let details = await this.detail.execute(state);
  }

Service: 

public async execute(state: any, filter?: any): Promise<any> {
    let data = await this.getDataTable(state, filter);
    super.next(data);
  }

public async getDataTable(state: DataStateChangeEventArgs, filter?: any): Promise<DataStateChangeEventArgs> {
    let { action }: any = state;
    let current_page: number = action?.currentPage ? action?.currentPage : 1;

    if (state.take == 1) {
      current_page = 0;
    }
    let data = await this.baseService
      .get('api/detail', {
        ...filter,
        page: current_page,
        page_size: state.take,
      })
      .toPromise();

    let detail: PaginationModel<detail> = data as PaginationModel<detail>;

    let dataResult: DataResult = {
      count: detail.total,
      result: detail.data,
    };
    return dataResult as any;
  }

3 Replies

AG Ajith Govarthan Syncfusion Team August 25, 2021 03:02 PM UTC

Hi Ihya Fauzi, 

Thanks for contacting Syncfusion support. 

Query: Pagination reset to first page after data updated 
 
Based on your query you are facing pagination reset to first page issue in your Grid application. So, before we proceed to your query, please share the below details to validate further on your requirement. 

  1. Share the complete Grid code example

  1. Share the video demonstration of the reported issue.
 
  1. Please ensure that you have written any code to navigate to first page in your Grid application while updating the data.
 
  1. If possible, please share the issue reproducible sample.
 
  1. Share the Syncfusion package version.
 
Regards, 
Ajith G. 




IF Ihya Fauzi replied to Ajith Govarthan August 26, 2021 03:32 AM UTC

1.Check file

5. 

"@syncfusion/ej2-angular-grids": "^18.4.49"

Attachment: sample_a3f430c8.zip


RR Rajapandi Ravi Syncfusion Team August 27, 2021 11:08 AM UTC

Hi Ihya, 

Thanks for the update 

Before we start providing solution on this query, we need some information for our clarification. So please confirm the below details that would be helpful for us to provide better solution. 

1)       Please share on what scenario you are facing a problem. 

2)       Share an issue replication procedure step by step. 

3)       Please share issue scenario in video demonstration format. 

Regards, 
Rajapandi R 


Loader.
Up arrow icon