bluewatertracks / bwt-datatable

Data table with Polymer 3 support!
GNU General Public License v3.0
42 stars 14 forks source link

How to transpose/pivot #16

Closed chavu closed 7 years ago

chavu commented 7 years ago

I have data in dataset like this:

Item supplier price

Item_1 Supplier_X 5.00 Item_1 Supplier_Y 5.50 Item_1 Supplier_Z 6.00 Item_2 Supplier_X 3.50 Item_2 Supplier_Y 3.00 Item_2 Supplier_Z 4.00

I want to display it like below using bwt-datatable.

Item Supplier_X Supplier_Y Supplier_Z

Item_1 5.00 5.50 6.00 Item_2 3.50 3.00 4.00

Is it possible to do this with datatable or the data has to be transformed while still at backend?

dhrytsenko commented 7 years ago

Hi @chavu. You need to transform your data to right format cause datatable don't perform any computation. l think your data must have the next structure for each item:

{
   itedId: 1,
   itemName: "Item_1"
   Supplier_X: 44,
   Supplier_Y: 1,
   Supplier_Z: 3,
}
chavu commented 7 years ago

Noted. I will do the transformation in the service at the server and output the JSON in the correct form as you pointed out.

dhrytsenko commented 7 years ago

ok, @chavu. If all will be ok please close this issue