question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Virtual Server-side Paging demo duplicates rows

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior on every page change, the data will be duplicates

Expected behavior on page change, no data duplication, simply show new data.

Reproduction of the problem

What is the motivation / use case for changing the behavior? I would like to use virtual server-side paging, but the given exemple doesn’t work. I’have to find by myself how to solve it.

Please tell us about your environment: Windows 7, firefox

  • Table version: 10.2.3
  • Angular version: ?
  • Browser: all
  • Language: all

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
alaingillercommented, Oct 4, 2017

After some analysis:

  1. ‘rows’ (data[]) size must be equals to ‘offset’ (page number) * ‘limit’ (page size)
  2. data in ‘rows’ of the current & previous page at least must be correct.
  3. data in ‘rows’ cannot be null/undefined but can be {}.
  4. setPage is for too often called (with same args)
  5. setPage is correctly called when one scroll down but not when one scroll up

So there my solution or workaround to always fetch correct data:

private fetch(): void {
  this.serverResultsService.getResults(this.page).subscribe(pagedData => {
    this.page = pagedData.page;
    this.rows= this.getRows(pagedData );
    if (page.pageNumber > 0) {
      this.page.pageNumber = this.page.pageNumber -1;
      this.serverResultsService.getResults(this.page).subscribe(pagedData2 =>{
        this.rows.splice(pagedData2.pageNumber * pagedData2 .pageSize, pagedData2 .size, ...pagedData2 .data);
      });
      this.page.pageNumber = this.page.pageNumber +1;
    }
  });
}
private getRows(page): object {
  const rows: [] = [...page.data];
  const result = Object.assign({}, page);
  result.data= [];
  result.data[page.pageNumber * page.pageSize] = null;
  result.data.fill(<any>{}, 0, page.pageNumber * page.pageSize);
  result.data.splice(page.pageNumber * page.pageSize, 1, ...rows);
  return result;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to implement server-side paging and infinite data scrolling
We are using the BindToLINQ method of the GridView. It appears to be sorting and filtering on the SQL server, but not paging....
Read more >
jqGrid sends duplicate ajax request for page number while ...
First of all sending of two requests to the server is by design in case of usage virtual scrolling ( scroll: 1 option)....
Read more >
How to avoid missing/duplicated data enabling server based ...
The issue of duplicates returned or missed records when querying the data can be avoided by using the "server based pagination". "Image/data in...
Read more >
Grid sends a request to the server when serverPaging is set to ...
I have a grid with endless scrolling. I want to load filtered rows to the grid. Any other operation shoud be performed on...
Read more >
Python-Driven Filtering, Paging, Sorting - Dash Plotly
With backend paging, we can load data into our table progressively. Instead of loading all of the data at once, we'll only load...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found