mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix: Table Panel and string values & numeric formatting (#16249)
This commit is contained in:
committed by
Torkel Ödegaard
parent
ad6b11c90a
commit
00a07c855d
@@ -177,7 +177,7 @@ export class TableRenderer {
|
||||
return '-';
|
||||
}
|
||||
|
||||
if (_.isString(v) || _.isArray(v)) {
|
||||
if (isNaN(v) || _.isArray(v)) {
|
||||
return this.defaultCellFormatter(v, column.style);
|
||||
}
|
||||
|
||||
|
||||
@@ -224,7 +224,12 @@ describe('when rendering table', () => {
|
||||
expect(html).toBe('<td>1.230 s</td>');
|
||||
});
|
||||
|
||||
it('number style should ignore string values', () => {
|
||||
it('number column should format numeric string values', () => {
|
||||
const html = renderer.renderCell(1, 0, '1230');
|
||||
expect(html).toBe('<td>1.230 s</td>');
|
||||
});
|
||||
|
||||
it('number style should ignore string non-numeric values', () => {
|
||||
const html = renderer.renderCell(1, 0, 'asd');
|
||||
expect(html).toBe('<td>asd</td>');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user