mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(table): added support for column units overriding style units for table
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user