diff --git a/src/legacy/core_plugins/vis_type_table/public/paginated_table/paginated_table.test.ts b/src/legacy/core_plugins/vis_type_table/public/paginated_table/paginated_table.test.ts
index 781782e42fbaf..1b16c201ae622 100644
--- a/src/legacy/core_plugins/vis_type_table/public/paginated_table/paginated_table.test.ts
+++ b/src/legacy/core_plugins/vis_type_table/public/paginated_table/paginated_table.test.ts
@@ -42,6 +42,7 @@ interface Column {
title: string;
formatter?: {
convert?: (val: string) => string;
+ [key: string]: any;
};
sortable?: boolean;
}
@@ -94,7 +95,11 @@ describe('Table Vis - Paginated table', () => {
if (isNumber(colCount)) {
times(colCount, i => {
- columns.push({ id: `${i}`, title: `column${i}`, formatter: { convert: identity } });
+ columns.push({
+ id: `${i}`,
+ title: `column${i}`,
+ formatter: { convert: identity, getConverterFor: () => identity },
+ });
});
} else {
columns = colCount.map(
@@ -102,7 +107,7 @@ describe('Table Vis - Paginated table', () => {
({
id: `${i}`,
title: col.title,
- formatter: col.formatter || { convert: identity },
+ formatter: col.formatter || { convert: identity, getConverterFor: () => identity },
} as Column)
);
}
@@ -678,6 +683,9 @@ describe('Table Vis - Paginated table', () => {
convert: val => {
return val === 'zzz' ? '
hello
' : val;
},
+ getConverterFor: () => (val: any) => {
+ return val === 'zzz' ? 'hello
' : val;
+ },
},
},
];
diff --git a/src/legacy/core_plugins/vis_type_table/public/paginated_table/rows.js b/src/legacy/core_plugins/vis_type_table/public/paginated_table/rows.js
index 2939534c6fa8d..4f41f0bacc221 100644
--- a/src/legacy/core_plugins/vis_type_table/public/paginated_table/rows.js
+++ b/src/legacy/core_plugins/vis_type_table/public/paginated_table/rows.js
@@ -21,6 +21,15 @@ import $ from 'jquery';
import _ from 'lodash';
import tableCellFilterHtml from './table_cell_filter.html';
+function getFormattedValue(formatter, value) {
+ const parsedUrl = {
+ origin: window.location.origin,
+ pathname: window.location.pathname,
+ };
+
+ return formatter.getConverterFor('html')(value, false, false, parsedUrl);
+}
+
export function KbnRows($compile) {
return {
restrict: 'A',
@@ -72,7 +81,7 @@ export function KbnRows($compile) {
// An AggConfigResult can "enrich" cell contents by applying a field formatter,
// which we want to do if possible.
- contents = contentsIsDefined ? column.formatter.convert(contents, 'html') : '';
+ contents = contentsIsDefined ? getFormattedValue(column.formatter, contents) : '';
if (_.isObject(contents)) {
if (contents.attr) {
diff --git a/src/legacy/ui/public/visualize/loader/pipeline_helpers/utilities.ts b/src/legacy/ui/public/visualize/loader/pipeline_helpers/utilities.ts
index d754c1d395595..950ac830780b6 100644
--- a/src/legacy/ui/public/visualize/loader/pipeline_helpers/utilities.ts
+++ b/src/legacy/ui/public/visualize/loader/pipeline_helpers/utilities.ts
@@ -146,7 +146,7 @@ export const getFormat: FormatFactory = mapping => {
basePath: npStart.core.http.basePath,
};
// @ts-ignore
- return format.convert(val, undefined, undefined, parsedUrl);
+ return format.getConverterFor(type)(val, false, false, parsedUrl);
};
},
convert: (val: string, type: string) => {
@@ -163,7 +163,7 @@ export const getFormat: FormatFactory = mapping => {
basePath: npStart.core.http.basePath,
};
// @ts-ignore
- return format.convert(val, type, undefined, parsedUrl);
+ return format.getConverterFor(type)(val, false, false, parsedUrl);
},
} as FieldFormat;
} else {