Skip to content

Conversation

@ivankolev
Copy link
Contributor

set rowCount to rows.length, to prevent 'Error: query at index -1 failed: Fenwick tree array not initialized.' and make the demo work properly at https://swimlane.github.io/ngx-datatable/#virtual-paging

What kind of change does this PR introduce? (check one with "x")

  • [ x] Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior? (You can also link to an open issue here)
As described in the issue #880 and currently on https://swimlane.github.io/ngx-datatable/#virtual-paging or http://localhost:9999/#virtual-paging, virtual paging demo throws an error because the rowCount does not properly reflect the number of rows

What is the new behavior?
Fixes the said javascript error and make the demo work as intended

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • [x ] No

…t index -1 failed: Fenwick tree array not initialized.' and make the demo work properly at https://swimlane.github.io/ngx-datatable/#virtual-paging
@Input() set rows(val: any[]) {
this._rows = val;
this.rowExpansions.clear();
this._rowCount = this._rows.length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work right since the row count varies. There is a function to get this information.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aah, I see that /#server-paging is indeed broken with my change. Wonder if it's worth it to maybe add more e2e tests that could potentially catch such errors.

@ivankolev
Copy link
Contributor Author

Ok, back to the drawing board then. It fixes the error and all the tests passed, so I assumed it was enough. So, just to make it clear, there could be cases where rowCount is not equal to the number of rows?

@amcdnl
Copy link
Contributor

amcdnl commented Jan 14, 2018

Server side paging.

@ivankolev
Copy link
Contributor Author

Alright, I have pushed my second attempt at it, both /#server-paging and /#virtual-paging seem to be working now...

@popovv1
Copy link

popovv1 commented Jan 19, 2018

@amcdnl Any directions if you think suggested fix is not good?
It would be good to make virtual-paging working, the first page used to load successfully. I think it stopped working after scroller performance fix 7227e55 to run 'scroll' listener outside of Angular.

Copy link
Contributor

@amcdnl amcdnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@amcdnl amcdnl merged commit 0098a48 into swimlane:master Jan 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants