shlomiassaf / ngrid

A angular grid for the enterprise
https://shlomiassaf.github.io/ngrid
MIT License
241 stars 41 forks source link

[Bug] filteredData not sorted when no filter used #203

Open spali opened 3 years ago

spali commented 3 years ago

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.