From 9065c5249c8c9b6aca72a10429f78caa487f3e23 Mon Sep 17 00:00:00 2001 From: Ezeon Date: Wed, 19 Apr 2017 10:16:25 +0200 Subject: [PATCH] feat(table): allow for default value to be set for new cells (#311) --- src/ng2-smart-table/lib/data-set/row.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ng2-smart-table/lib/data-set/row.ts b/src/ng2-smart-table/lib/data-set/row.ts index 8bf4def62..c44c9e521 100644 --- a/src/ng2-smart-table/lib/data-set/row.ts +++ b/src/ng2-smart-table/lib/data-set/row.ts @@ -49,7 +49,8 @@ export class Row { } createCell(column: Column): Cell { - const value = typeof this.data[column.id] === 'undefined' ? '' : this.data[column.id]; + const defValue = (column as any).settings.defaultValue ? (column as any).settings.defaultValue : ''; + const value = typeof this.data[column.id] === 'undefined' ? defValue : this.data[column.id]; return new Cell(value, this, column, this._dataSet); } }