I'm having trouble getting the export to excel working, it throws Cannot read property 'length' of undefined in jquery
Here is MVC Grid Declaration:
@(Html.Kendo().Grid<TransactionViewModel>()
.Name(
"completedgrid"
)
.Columns(columns =>
{
columns.Bound(m => m.StudentCode);
columns.Bound(m => m.date).Title(
"Date"
);
columns.Bound(m => m.amount).ClientTemplate(
"#=kendo.toString(data.amount,'c')#"
).Title(
"Amount"
);
})
.ToolBar(toolbar =>
{
toolbar.Excel();
})
.Excel(e =>
{
e.FileName(
"TransactionList.xlsx"
);
})
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action(
"StudentPayments_Read"
,
"PaymentsGrid"
).Data(
"getCompletedData"
))
)
)
In case you need getCompletedData:
function getCompletedData() {
return
{
"id"
: @ViewBag.LocationId,
"date"
:sel};
}
sel is just a string containing date information like "01 2017"
TransactionViewModel:
public
class
TransactionViewModel
{
public
string
StudentCode;
public
decimal
amount;
public
string
date;
}
Everything seems pretty simple, I can't see what I'm missing. The controller was scaffolded so was the grid. I had to add the filename for the excel export, and I added the date filter.
I tried adding a proxyurl but it didn't change the result so I took it out, assuming its not needed.
Any help is appreciated,
Thank you