We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1703951 commit 198f6c1Copy full SHA for 198f6c1
src/DataTable.spec.ts
@@ -291,8 +291,9 @@ describe("DataTable directive tests", ()=> {
291
it("should sort data by child property value", ()=> {
292
let newData = [
293
{name: 'Claire', city: {zip: '51111'}},
294
- {name: 'Anna', city: {zip: '31111'}},
+ {name: 'Anna'},
295
{name: 'Claire', city: {zip: '41111'}},
296
+ {name: 'Donald', city: 2},
297
{name: 'Claire', city: {zip: '11111'}},
298
{name: 'Anna', city: {zip: '21111'}}
299
];
@@ -303,9 +304,10 @@ describe("DataTable directive tests", ()=> {
303
304
expect(datatable.data).toEqual([
305
306
{name: 'Anna', city: {zip: '21111'}},
307
308
309
310
311
]);
312
});
313
src/DataTable.ts
@@ -153,7 +153,9 @@ export class DataTable implements OnChanges, DoCheck {
153
return (row: any): any => {
154
var value = row;
155
for (let sortByProperty of sortBy.split('.')) {
156
- value = value[sortByProperty];
+ if(value) {
157
+ value = value[sortByProperty];
158
+ }
159
}
160
if (value && typeof value === 'string' || value instanceof String) {
161
return value.toLowerCase();
0 commit comments