Dynamic Columns not recognizing keys beyond first row

I've been experimenting with dynamic columns, noticed that it only recognizes keys from the first row.

The current workaround I have is to have the transformer run through the dataset and add an object with all keys, and filter that row out. Which needs me to have one static column.

Was wondering if there is a better way to get around this.

Maybe you can write a transform with lodash

const queryData = [{id:1,a:1,b:2,c:2},{id:2,a:1,c:2},{id:3,a:1,b:2,c:3,d:4}];
const result = _.map(queryData, item => _.keys(item));
const uniq = _.uniq(_.flatten(result));
const modifidData = _.map(queryData,obj=>{ _.map(uniq, item=>{ if(obj[item]===undefined){ obj[item]=null}; });return obj; });

image

this operation will let the object in array with same properties.

2 Likes