shlomiassaf/ngrid

[Bug] filteredData not sorted when no filter used

spali opened this issue · 0 comments

spali commented

What is the expected behavior?

filteredData should be always sorted, even if data is not filtered.

What is the current behavior?

if no filter used, filteredData should return the same array as sortedData.

What are the steps to reproduce?

  1. Simple table with matSort.
  2. Sort any column.
  3. dump sortedData and filteredData to the console.

sortedData matches the rendered table. filteredData has the contains the unsorted datasource.

Which versions of Angular, CDK, Material, NGrid, OS, TypeScript, browsers are affected?

angular: 12.0
ngrid: 4.0.0-alpha.3

Is there anything else we should know?

Currently I workaroud by accessing like:

            const data =
              this.grid.ds.filter !== undefined
                ? this.grid.ds.filteredData
                : this.grid.ds.sortedData;

If this is by design, do not hesitate closing this issue.