Query |
Response |
Is there a way to group on the id but show the actual name from the products collection in the UI? |
The pivot table accepts flat JSON data as it's data source. And any complex object inside the JSON isn't supported. So kindly make your data source as flat JSON and bind to the component.
|
I can do some formatting for numbers and dates in value cells but it would be handy to have a custom template option for row and column headers (similar to the template functionality in the datagrid). |
Please check the below documentation and online demo link of cell template option in pivot table for your reference to customize the row and column headers.
Meanwhile, we have prepared a sample for your reference.
|
Also I found queryCellInfo and headerCellInfo documentation but that solution seems to manipulate the html directly and it not very react like. |
Could you please share us your exact requirement ? So that we can provide you a better solution. |
So please tell me what is the preferred way of having customised row/column headers. |
You can customize the row/ column headers using headerCellInfo, queryCellInfo events and cell template option.
Please find the UG documentation for each items,
QuerycellInfo & HeadercellInfo: https://ej2.syncfusion.com/react/documentation/pivotview/row-and-column/#events
CellTemplate:
|
cellTemplate({ cellType, fieldname, value }) {
if (fieldname && cellType == 'rowsheader') {
const product = products.find(p => p._id==value);
return <span>{product.Name}</span>;
}
return;
}
The column template
has options to display custom element instead of a field value in the column.
So my question is is this already possible in a 'React' way like I described? Or are you open for a Feature Request for this scenario? I think uit would improve things fro React developers.
Best regards,
Mark.
Query |
Response |
It would be more react like if, for example, the cellTemplate function could be expanded with some basic properties (like the 'type' of cell (rowheader, colheader or valuecell) and value and fieldname). |
The reported requirement (https://www.syncfusion.com/feedback/17507) has been included in the weekly release (v18.2.0.56) and it is available in nuget.org (https://www.nuget.org/). Meanwhile, we have prepared a sample for your reference.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Pivot_Table155279-1996750885
|
Plus there should be an option for the cellTemplate to replace the content in the 'e-cellvalue' and not append to it. |
There is no direct option to achieve the requirement. But kindly use the queryCellInfo event to customize the HTML elements of row headers and value cells.
|