MCPcopy Create free account
hub / github.com/angular/components / sortData

Method sortData

src/material/sort/testing/sort-harness.spec.ts:150–162  ·  view source on GitHub ↗
(sort: Sort)

Source from the content-addressed store, hash-verified

148 sortedData = this.desserts.slice();
149
150 sortData(sort: Sort) {
151 const data = this.desserts.slice();
152
153 if (!sort.active || sort.direction === '') {
154 this.sortedData = data;
155 } else {
156 this.sortedData = data.sort((a, b) => {
157 const aValue = (a as any)[sort.active];
158 const bValue = (b as any)[sort.active];
159 return (aValue < bValue ? -1 : 1) * (sort.direction === 'asc' ? 1 : -1);
160 });
161 }
162 }
163}

Callers 2

testSortWithValuesFunction · 0.45
_orderDataMethod · 0.45

Calls 1

sortMethod · 0.65

Tested by

no test coverage detected