do not remove properties from item in cor-table-column

This commit is contained in:
alecmerdler 2017-04-21 13:26:51 -07:00
parent 624d8e1851
commit 33cecb042c

View file

@ -54,8 +54,7 @@ export class CorTableComponent implements OnChanges {
}
private tablePredicateClass(col: CorTableColumn, options: any) {
return this.TableService.tablePredicateClass(col.datafield, this.options.predicate,
this.options.reverse);
return this.TableService.tablePredicateClass(col.datafield, this.options.predicate, this.options.reverse);
}
private refreshOrder(): void {
@ -64,28 +63,24 @@ export class CorTableComponent implements OnChanges {
columnMap[col.datafield] = col;
});
var filterCols = this.columns.filter(function(col) {
return !!col.sortfield;
}).map((col) => (col.datafield));
const filterCols = this.columns.filter(col => !!col.sortfield)
.map(col => col.datafield);
var numericCols = this.columns.filter(function(col) {
return col.isNumeric();
}).map((col) => (col.datafield));
const numericCols = this.columns.filter(col => col.isNumeric())
.map(col => col.datafield);
var tableData = this.tableData || [];
var processed = tableData.map((item) => {
var keys = Object.keys(item);
var newObj = {};
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
const tableData = this.tableData || [];
const processed = tableData.map((item) => {
var newObj = Object.assign({}, item);
Object.keys(item).forEach((key) => {
if (columnMap[key]) {
newObj[key] = columnMap[key].processColumnForOrdered(this.TableService, item[key]);
}
}
});
return newObj;
});
this.orderedData = this.TableService.buildOrderedItems(processed, this.options,
filterCols, numericCols);
this.orderedData = this.TableService.buildOrderedItems(processed, this.options, filterCols, numericCols);
}
}