I tried to search knowledge base and other documents but could not find answer to following requirement.
In the sample code using Product Details, how to add "Product Code" and "Product Name" both while pivoting will be only on Product Code.
I want to display both product code and product name. But if I add both as rows it will add additional group and sum row .
I simply want product code and name displayed in an additional column because they are just two values representing one entity
How to achieve it?
Hi Manoj,
We believe that your requirement is to display the pivot table in "Classic layout" (aka, Excel's "Tabular" form). If this is the case, we regret to inform you that our Syncfusion Pivot Table currently supports only the "ExcelLike" layout. This layout resembles Excel's "Compact" form, which is the default layout in recent versions of Microsoft Excel. It displays row fields in grouped fashion with slight indentation based on row level, resulting in a more compact appearance, especially when compared to the tabular form.
Regards,
Mohanraj Elumalai.
The reply relates to grouping where second grouped items appears below it with indentation.
For me "Product Code" and "Product Name" are just one thing .
I cannot group for both as Product Name is simply detailed description of product code.
While product code is UNIQUE product name may not be UNIQUE
To explain it further, in a educational institute, we will have Student Code and Student Name.
Student Code will be UNIQUE but Student name will not be unique.
It will be difficult to remember student code for all students so both student code and student name is required to be displayed together in adjacent columns.
Hi Manoj,
We believe that your requirement is to display Pivot table as “Classic layout”. If so, we currently do not support rendering classic layout in our EJ2 pivot table.
Classic layout of Excel Pivot table.
Furthermore, based on the current architecture, our pivot table can only display an Excel-like layout (aka, compact view).
|
Compact view of Excel Pivot table |
Syncfusion Pivot table |
|
|
|
If your requirement differs from the above provided information, please provide us with additional information with screenshots that illustrate your requirement. This would allow us to check your needs and provide details as soon as possible.
Regards,
Angelin Faith Sheeba.
In think I am not able to explain properly.
The images show data grouped on Country and Quarter. These two are different as entity.
Similarly Country and Product are different entity.
In your case if you want to display Mountain Bike product code as M001 , how to do that.
There could be:
=================================
Code : Description
=================================
M001: Mountain Bike Standard
M002: Mountain Bike Super
M003: Mountain Bike Premium
=================================
So M001 (Code) and Mountain Bike Standard (Description) should appear in the table for clarity.
I hope I am able to explain.
Hi Manoj,
We believe that your requirement is to customize the headers of the pivot table by incorporating additional data from the data source. If this is the case, you can achieve it by using the CellTemplate option. In the example code below, we retrieve corresponding cell relevant data from the data source to customize the row headers and display it in the pivot table. Moreover, we have prepared a sample for your reference below.
Please note that, to obtain specific cell’s data information from the data source while using the cell template, please set the AllowDrillThrough property to true.
Code Example:
|
<SfPivotView @ref="Pivot" TValue="ProductDetails" Height="500" ShowFieldList="true" AllowDrillThrough="true" AllowCalculatedField="true" ShowGroupingBar="true"> <PivotViewTemplates> <CellTemplate> @{ var data = (context as AxisSet); if (data != null) { if (data.Axis == "row" && data.Type != "grand sum") { data.FormattedText = data.FormattedText + " " + Data[data.Index[0]].Country; <PivotViewDataSourceSettings DataSource="@Data" ExpandAll="false" EnableSorting=true> </PivotViewDataSourceSettings> </SfPivotView>
|
Sample: https://blazorplayground.syncfusion.com/VDrKtuBZpRxpBqRZ
Output Screenshot:
For more about cell template feature, please refer to the document link below.
Document: https://blazor.syncfusion.com/documentation/pivot-table/row-and-column#cell-template
Please let us know if you have any concerns.
Regards,
Mohanraj Elumalai.