Fixes filters emitted from table viz (#2335)

This commit is contained in:
Maxime Beauchemin 2017-03-06 15:14:08 -08:00 committed by GitHub
parent bd480e0c6b
commit ad4a950b56
2 changed files with 16 additions and 11 deletions

View File

@ -110,6 +110,10 @@ class ChartContainer extends React.PureComponent {
{}
),
addFilter: () => {},
removeFilter: () => {},
done: () => {},
clearError: () => {
// no need to do anything here since Alert is closable

View File

@ -68,18 +68,24 @@ function tableVis(slice, payload) {
.enter()
.append('tr')
.selectAll('td')
.data((row) => data.columns.map((c) => {
let val = row[c];
.data(row => data.columns.map(c => {
const val = row[c];
let html;
const isMetric = metrics.indexOf(c) >= 0;
if (c === 'timestamp') {
val = timestampFormatter(val);
html = timestampFormatter(val);
}
if (typeof(val) === 'string') {
val = `<span class="like-pre">${val}</span>`;
html = `<span class="like-pre">${val}</span>`;
}
if (isMetric) {
html = slice.d3format(c, val);
}
return {
col: c,
val,
isMetric: metrics.indexOf(c) >= 0,
html,
isMetric,
};
}))
.enter()
@ -118,12 +124,7 @@ function tableVis(slice, payload) {
.style('cursor', function (d) {
return (!d.isMetric) ? 'pointer' : '';
})
.html((d) => {
if (d.isMetric) {
return slice.d3format(d.col, d.val);
}
return d.val;
});
.html(d => d.html ? d.html : d.val);
const height = slice.height();
let paging = false;
let pageLength;