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.

[externalPaging]="true" causes rows to disappear?

See original GitHub issue

Hi,

I’m trying to use server pagination but the moment I switch the externalPaging flag to true, I’m unable to get any rows to render. I’ve tried to follow the demo code and apply it to my own situation but still haven’t got anywhere. Here’s my code at the moment:

// in view...
            <ngx-datatable
                class="material"
                [rows]="rows"
                [columns]="columns"
                [columnMode]="'force'"
                [headerHeight]="50"
                [footerHeight]="50"
                [externalPaging]="true"
                [count]="count"
                [offset]="offset"
                [limit]="limit"
                (page)="onPage($event)"    
            >
            </ngx-datatable>

// further down...
    ngOnInit() {    
        this.taskService.testWithPaging(1).subscribe((tasks) => { 
            tasks.map((task, i) => { 
                    this.rows[i++] = { id: task.id, researcher: task.researcher, details: task.details };
            });
      });
    }

I’ve verified and the taskService method returns 100 objects with the properties id, researcher and details. This works without issue when I remove the externalPaging flag (or set it to false) but having it switched on, results in nothing being shown. Is the way in which I’m populating the “rows” variable incorrect?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:28 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
szanellacommented, Apr 27, 2017

When paginating externally, the behaviour I’d expect is that the table component should simply output any changes of the current page and be fed with the current page rows that are retrieved externally, usually through an Http request.

From what I’ve seen, this does not happen; what happens instead is that the table component always requires the full data set and moves its offset based on the current page.

As an example, suppose I have 10 items per page, and I move to the third page: what I’d expect to happen is I get an event that signals me I need to get data for the third page (this already works); then I get the 10 items for the third page and feed them as rows to the table. What should happen now is that the table receives them and, knowing we’re using externalPaging, simply displays them; what actually happens is that the table treats them as the full data set and tries to offset them to the third page (as if we weren’t using externalPaging), resulting in an empty output.

This implies that pagination is still handled by the datatable component, and not externally, and makes the externalPaging function somewhat pointless.

Update: @amcdnl I reckon this is related to #138 , which should’ve been fixed by the pull request #714 I’m trying it out

3reactions
DanjBethelcommented, Dec 22, 2016

this.count = tasks.length;

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ngx-datatable not showing data - Stack Overflow
Issue 1: From [externalPaging]="true" causes rows to disappear? You need to set the count property to the total number of rows.
Read more >
Efficiently Paging Through Large Amounts of Data (C#)
The default paging option of a data presentation control is unsuitable when working with large amounts of data, as its underlying data ...
Read more >
Show / Search / Pagination - disappears when column is ...
Hello - i have the following code - which is working fine (with show / search pagination informatoin -)
Read more >
Paging | Android Developers
PagingSource.LoadResult.Invalid has been added as a new return type from PagingSource.load , which causes Paging to discard any pending or future load requests ......
Read more >
Row Dragging - JavaScript Data Grid
To enable row dragging on all columns, set the column property rowDrag = true on one (typically the first) column. const gridOptions =...
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