PivotView displaying string data and aggregation configuration

Hi,

I'm utilizing the Syncfusion React EJ2 PivotView to present my data. Below is my data in JSON format:

[

   {

      "id": "1",

      "pokemonPower": "20",

      "pokemonName": "Pikachu",

      "pokemonAge": 20,

      "pokemonSuccessRate": 200

   },

   {

      "id": "1",

      "pokemonPower": "20",

      "pokemonName": "Pikachu",

      "pokemonAge": 50,

      "pokemonSuccessRate": 300

   },

   {

      "id": "1",

      "pokemonPower": "20",

      "pokemonName": "Pikachu",

      "pokemonAge": 100,

      "pokemonSuccessRate": 500

   },

   {

      "id": "2",

      "pokemonPower": "25",

      "pokemonName": "Bulbasaur",

      "pokemonAge": 20,

      "pokemonSuccessRate": 699

   },

   {

      "id": "2",

      "pokemonPower": "25",

      "pokemonName": "Bulbasaur",

      "pokemonAge": 50,

      "pokemonSuccessRate": 33400

   },

   {

      "id": "2",

      "pokemonPower": "25",

      "pokemonName": "Bulbasaur",

      "pokemonAge": 100,

      "pokemonSuccessRate": 1110

   }

]

I want the PivotView to display the data exactly like this:


I've configured the PivotView with the "id" field as rows and the other fields as columns. However, I'm facing two main challenges:


1. I'm unable to display the "pokemonName" in each field. It seems that the PivotViewComponent only accepts numeric values for its cells.


2. The tool automatically aggregates all the records with the same "id" value and displays them in a single row with summed values. I don't want this; I want to see each record separately.


Could you please provide guidance on how I can achieve this? Your assistance is greatly appreciated. If you have any questions about my inquiry, please feel free to ask.

Thank you!


1 Reply

AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team November 6, 2023 11:29 AM UTC

Hi Gokhan,


We would like to let you know that our pivot table always renders as an aggregated table with a row, column, and value axis. As a result, we are unable to show the pivot table in the manner of a flat grid as per your requirement. However, we recommend you use our EJ2 Data Grid(Flat grid) to display the data as a flat table. Please refer the below demo sample and the documentation to know more about the EJ2 react data grid.


Data grid:


Demo: https://ej2.syncfusion.com/react/demos/#/material3/grid/default

Grouping demo: https://ej2.syncfusion.com/react/demos/#/material3/grid/grouping

Document: https://ej2.syncfusion.com/react/documentation/grid/getting-started


Please let us know if any concern occurs.


Regards,

Angelin Faith Sheeba.


Loader.
Up arrow icon