Hello,
When attempting to export my ejGrid into an excel format I am getting this error:
"ej.webform.min.js:10 Uncaught TypeError: Cannot read property 'indexOf' of undefined
at Object.ej.raiseWebFormsServerEvents (ej.webform.min.js:10)
at Object.export (ej.web.all.min.js:10)
at Object._toolbarOperation (ej.web.all.min.js:10)
at Object._toolBarClick (ej.web.all.min.js:10)
at Object._trigger (ej.web.all.min.js:10)
at Object._onItemClick (ej.web.all.min.js:10)
at HTMLLIElement.<anonymous> (ej.web.all.min.js:10)
at HTMLLIElement.dispatch (jquery-3.1.1.min.js:3)
at HTMLLIElement.q.handle (jquery-3.1.1.min.js:3)"
here is my javascript code. You will notice some code commented out as I was attempting to try different forms of exporting that I had found on the threads, but each of them are giving me the same error.
$("#GridContainer").ejGrid({
dataSource: ej.DataManager(list),
//dataSource: ej.DataManager({ url: "http://js.syncfusion.com/ExportingServices/Northwnd.svc/Orders/" }),
allowScrolling: true,
columns: columns,
allowSorting: true,
height: '70vh',
allowReordering: true,
allowSearching: true,
allowResizing: true,
toolbarSettings: {
showToolbar: true,
toolbarItems: [
"search", ej.Grid.ToolBarItems.PrintGrid, ej.Grid.ToolBarItems.ExcelExport,
ej.Grid.ToolBarItems.PdfExport
]
},
showSummary: true,
allowGrouping: true,
allowResizeToFit: true,
groupSettings: { groupedColumns: [] },
exportToExcelAction: spaceManagementAreaUrl + "Grid/ExcelExport",
summaryRows: [
{
title: "Total",
showTotalSummary: true,
showCaptionSummary: true,
summaryColumns: [
{
summaryType: ej.Grid.SummaryType.Sum,
displayColumn: displayColumn,
dataMember: displayColumn,
format: '{0:N2}'
}
]
}
],
/* toolbarClick: function(args) {
if (args.itemName === "Excel Export") {
alert('hello');
args.cancel = true;
alert('part 2');
this.export(spaceManagementAreaUrl+ "Grid/ExcelExport"); // Excel Export method.
}
}*/
});
On the server side (Asp.net Controller) I have copied what i saw on the site.
[System.Web.Http.ActionName("ExcelExport")]
[AcceptVerbs("POST")]
public void ExcelExport()
{
string gridModel = System.Web.HttpContext.Current.Request.Params["GridModel"];
GridProperties gridProperty = ConvertGridObject(gridModel);
ExcelExport exp = new ExcelExport();
IEnumerable<object> result = _polys;
exp.Export(gridProperty, result, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat- saffron");
}
could you help me in understanding what could be happening and what I can do to fix this. Thank you!