Hi,
When I'm using the export to excel function it works fine. But once I add an aggregate to the datasource as in one of the demos, I get the error attached.
Is one of my configurations wrong?
Your help will be much appreciated.
Thanks,
Waldo
My Code is as follows:
@helper TreeGrid()
{
<div>
@(Html.Kendo().TreeList<OrgStructureViewModel>()
.Name(
"treelist"
)
.Columns(columns =>
{
columns.Add().Field(e => e.Full_Name)
.FooterTemplate(
"<strong>#= count # employee(s)</strong>"
);
columns.Add().Field(e => e.Emp_No);
columns.Add().Field(e => e.Man_No).Hidden(
true
);
columns.Add().Field(e => e.Division_ID).Template(
"#= Division #"
);
columns.Add().Field(e => e.Title);
columns.Add().Command(c => { c.Edit(); c.Destroy(); }).Width(220);
})
.Toolbar(x => { x.Create(); x.Excel(); x.Pdf(); })
.Editable(x => x.Mode(
"popup"
))
.Filterable()
.ColumnMenu(
true
)
.Scrollable(
true
)
.Sortable()
.Resizable(
true
)
.Excel(excel => excel
.FileName(
"Reporting_Line.xlsx"
)
.ProxyURL(Url.Action(
"Export_Save"
,
"Reporting_Line"
))
)
.Pdf(pdf => pdf
.FileName(
"Reporting_Line.pdf"
)
.ProxyURL(Url.Action(
"Export_Save"
,
"Reporting_Line"
))
)
.Events(ev => ev.Edit(
"onEdit"
))
.DataSource(dataSource => dataSource
.Read(read => read.Action(
"Reporting_LineRead"
,
"OrgStructure"
))
.Update(update => update.Action(
"Reporting_LineEdit"
,
"OrgStructure"
))
.Create(create => create.Action(
"Reporting_LineAdd"
,
"OrgStructure"
))
.Destroy(delete => delete.Action(
"Reporting_LineDelete"
,
"OrgStructure"
))
.ServerOperation(
false
)
.Aggregates(aggr =>
{
aggr.Add(e => e.Full_Name).Count();
})
.Model(m =>
{
m.Id(f => f.Reporting_Line_ID);
m.ParentId(f => f.ReportsTo);
m.Field(f => f.Emp_No);
m.Field(f => f.Man_No);
m.Field(f => f.Division_ID);
m.Expanded(
false
);
})
)
)
}
<script type=
"text/javascript"
>
function
onEdit(e) {
console.log(e);
if
(!e.model.isNew()) {
$(
"#Emp_No"
).data(
"kendoComboBox"
).enable(
false
);
}
else
{
$(
"#Division_ID"
).data(
"kendoDropDownList"
).enable(
false
);
}
}
function
filterEmployees() {
console.log($(
"#Emp_No"
).data(
"kendoComboBox"
).value());
return
{
empNo: $(
"#Emp_No"
).data(
"kendoComboBox"
).value(),
text: $(
"#Man_No"
).data(
"kendoComboBox"
).text()
};
}
</script>
​