ngx-datatable icon indicating copy to clipboard operation
ngx-datatable copied to clipboard

Table calls sortInternalRows with externalSorting=true

Open dmartin-gh opened this issue 7 years ago • 6 comments

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

When externalSorting is enabled, the sortInternalRows() method is still called due to this commit: https://github.com/swimlane/ngx-datatable/commit/67a4e8aeaf6c03e7fa3bc6a6d0a34725ec1c6b0a This causes the rows to change their sort order in undesirable ways after they are passed to the datatable component. Single sorting seems to work fine, but when combined with [sortType]="'multi'" the sort order is incorrect.

I believe the additional call to sortInternalRows() added to the translateColumns() method should be changed to:

if (!this.externalSorting) {
    this.sortInternalRows();
}

Expected behavior

Multi sorting would work correctly with externalSorting=true and the grid would never attempt to sort the rows itself.

Reproduction of the problem

Turn on [externalSorting]="true" and [sortType]="'multi'" and see that the sortInternalRows() method is called.

Please tell us about your environment:

  • Table version: 11.3.0
  • Angular version: 5.2.4
  • Browser: Chrome 67.0.3396.99
  • Language: TypeScript 2.5.3

dmartin-gh avatar Jun 27 '18 21:06 dmartin-gh