This is a migrated thread and some comments may be shown as answers.

Excel export with aggregates not working

3 Answers 186 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shuja
Top achievements
Rank 1
Shuja asked on 21 Nov 2014, 01:39 PM
I have a grid defined as:-
@(Html.Kendo().Grid<WT_Portal_PMS2.Models.ClockStopsSummary>()
    .Name("StopGrid")
    .Columns(col =>
        {
            col.Bound(o => o.CurrentWaitingBand).Title("Weeks Waited").ClientFooterTemplate("Total");
            col.Bound(o => o.DNA).Title("DNA").ClientFooterTemplate("#= sum  #"); ;
            col.Bound(o => o.IP).Title("Admitted").ClientFooterTemplate("#= sum  #"); ;
            col.Bound(o => o.OP).Title("Non-Admitted").ClientFooterTemplate("#= sum  #"); ;
 
 
        })
       .ToolBar(tools => tools.Excel())
                   .Excel(excel => excel
                                    .FileName("ClockStopsSummary.xlsx")
                                    .Filterable(true)
                                    .AllPages(true)
                                    .ProxyURL(Url.Action("Excel_Export_Save", "IPWLDQ"))
                                    )
              
 
        .DataSource(ds => ds
        .Ajax()
                .Aggregates(ag =>
                {
                    ag.Add(p => p.DNA).Sum();
                    ag.Add(p => p.IP).Sum();
                    ag.Add(p => p.OP).Sum();
                })
        .PageSize(25)
                        .Model(m => m.Id(p => p.CurrentWaitingBand))
                  .Read(rd => rd.Action("_Table", "StopsAnalysis")
                       .Data("specFilter")
 
        )
        )
                
        .Sortable()
 
)


When I try to export the grid to Excel, a javascript error in kendo.all.min.js of 'Unhandled exception at line 578, column 7 in Function code0x800a138f - JavaScript runtime error: Object expected' is thrown.

If I remove the aggregate expressions, the export runs without a problem.  I see the demo example uses aggregates, but can't see any obvious differences. 

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 25 Nov 2014, 08:43 AM
Hello,

It is indeed strange as the online demo supports aggregates just fine. Could you open a support ticket and send us a runnable sample which reproduces the JS error? We suspect something in the data is causing the error but cannot be sure until we reproduce it at our side.

Regards,
Atanas Korchev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Shuja
Top achievements
Rank 1
answered on 25 Nov 2014, 04:21 PM
Thanks, I'll see what I can put together.
0
John
Top achievements
Rank 1
answered on 12 Dec 2014, 01:46 PM
I have the same issue, works great for grids w/out an aggregate footer.  I get a javascript runtime error: object expected in the footertemplate area of kendo.all.min for those with aggregate functions.

I create all most my grids using razor vs the js route if that makes any difference to you.  Maybe something's getting lost in the translation?
Tags
Grid
Asked by
Shuja
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Shuja
Top achievements
Rank 1
John
Top achievements
Rank 1
Share this question
or