feat(table): added support for column units overriding style units for table

This commit is contained in:
Torkel Ödegaard
2016-05-03 11:29:51 +02:00
parent 6dc24ab2d7
commit 5ffd57695c
2 changed files with 18 additions and 6 deletions

View File

@@ -36,7 +36,7 @@ export class TableRenderer {
return v;
}
createColumnFormater(style) {
createColumnFormater(style, column) {
if (!style) {
return this.defaultCellFormater;
}
@@ -53,7 +53,7 @@ export class TableRenderer {
}
if (style.type === 'number') {
let valueFormater = kbn.valueFormats[style.unit];
let valueFormater = kbn.valueFormats[column.unit || style.unit];
return v => {
if (v === null || v === void 0) {
@@ -85,7 +85,7 @@ export class TableRenderer {
let column = this.table.columns[colIndex];
var regex = kbn.stringToJsRegex(style.pattern);
if (column.text.match(regex)) {
this.formaters[colIndex] = this.createColumnFormater(style);
this.formaters[colIndex] = this.createColumnFormater(style, column);
return this.formaters[colIndex](value);
}
}