react-pivottable icon indicating copy to clipboard operation
react-pivottable copied to clipboard

How to map field value to other as table header(col name, row name)

Open crapthings opened this issue 7 years ago • 2 comments

[
  { _id: 1, name: 'john', count: 30 },
  { _id: 2, name: 'john', count: 120 },
]

if i drag name as row, i can't get distinction which john is.

crapthings avatar Feb 05 '18 09:02 crapthings

Indeed, and this is by design. The aim of a pivot table is to aggregate data, so for the dataset listed above, you can use this library to display e.g. the number of john rows or the sum or average of the count attribute of john rows. If you wish to have one aggregate per row, you will need to drag the _id field to the column or row area, but then no aggregation will occur.

nicolaskruchten avatar Feb 05 '18 14:02 nicolaskruchten

our real id is like KPsgwn6Ajz7cMYTH4

leave this to table will take to much space, and user can't understand what it is.

if something we can have an option to specify

_id: name _id: function() { return name + other }

that would be great.

KPsgwn6Ajz7cMYTH4 JP3qrZXPCixATgGrQ
john john
john john

for now i think its okay to map row index and prefix it with same value like title, name etc by manually

crapthings avatar Feb 06 '18 01:02 crapthings