ExportDetailTemplate is not working

I am trying to export the Data grid along with childTable. I am using toolBarClick and exportDetailTemplate, but the issue is the control is not coming into exportDetailTemplate? Please help me how i can make this work.

cshtml:

<div style="padding: 5px;">
<ejs-grid id="detailGrid" recordDoubleClick="onDoubleClickDetailGrid"
allowGrouping="false" class="topgrid" allowPaging="true" allowExcelExport="true"
toolbar="@(new List<string>() {"ExcelExport","CsvExport"})" toolbarClick="detailsGrid"
detailTemplate="#detailtemplate" detailDataBound="detailDataBound" exportDetailTemplate="exportDetailTemplate">
<e-grid-pagesettings pageCount="5"></e-grid-pagesettings>
<e-grid-selectionsettings type="Single" persistSelection="true" enableToggle="false"></e-grid-selectionsettings>
</ejs-grid>
</div>


cshtml.cs:


I built the model and values here, 


.js :



function detailDataBound(args) {
console.log(args);
var d = args.data.childTable;

if (d != "") {
var data = JSON.parse(d);
console.log(data);
var detail = new ej.grids.Grid({
dataSource: data,
columns: [
{ field: 'Session', headerText: 'Session', width: 110 },
{ field: 'Qty', headerText: 'Qty', width: 110 },
{ field: 'childTable', headerText: 'Details', width: 110, template: "#childTemplate" }
]
});
detail.queryCellInfo = querycell;
detail.appendTo(args.detailElement.querySelector('.custom-grid'));
}
}

function detailsGrid(args) {
var gridObj = document.getElementById("detailGrid").ej2_instances[0];
if (args.item.id === 'detailGrid_excelexport') {
var excelExportProperties = {
hierarchyExportMode: 'All',
fileName: "detail-by-purchase.xlsx"
};
gridObj.excelExport(excelExportProperties);
} else if (args.item.id === 'detailGrid_csvexport') {
var excelExportProperties = {
fileName: "detail-by-purchase.csv"
};
gridObj.csvExport(excelExportProperties);
};
}


function exportDetailTemplate(args) {
console.log("EXPORT DETAIL TEMPLATE");
}

1 Reply

AR Aishwarya Rameshbabu Syncfusion Team August 1, 2024 02:18 PM UTC

Hi Jeyakaran Karnan,


Greetings from Syncfusion support.


We have reviewed your query and noticed that the exportDetailTemplate event is not triggered properly during Excel exporting in the Syncfusion Grid. To provide you with an optimal solution, we require additional information. Please provide the following details:

  1. Describe your exact requirement in detail, including the code lines for the detail template.
  2. Please Confirm whether you are attempting to render another Grid as detailTemplate within the Grid.
  3. If yes, share the code lines for the childTemplate and those used in the queryCellInfo event of the Grid created in the detailDataBound event.
  4. Provide a simple sample that replicates the issue including a video demonstration of issue replication procedure.
  5. Specify the current Syncfusion package version you are using.


Regards

Aishwarya R


Loader.
Up arrow icon