Excel Export With Ajax Paging

6 posts, 0 answers
  1. Umut
    Umut avatar
    6 posts
    Member since:
    Mar 2015

    Posted 25 Mar 2015 Link to this post

    I did the same as tutorial http://demos.telerik.com/aspnet-mvc/grid/excel-export . But as you can see in the tutorial, when you export the excel, it contains only page 1. 
    I want to export all the the pages. How should i do ? 

    Regards.
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2311 posts

    Posted 27 Mar 2015 Link to this post

    Hello Umut,

    In order to achieve this you should enable the allPages options of the Excel export.
    E.g.

    .Excel(excel => excel
        .FileName("Kendo UI Grid Export.xlsx")
        .AllPages(true)
        ...
    )

     

    Regards,
    Dimiter Madjarov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. David
    David avatar
    2 posts
    Member since:
    Jun 2015

    Posted 09 Jun 2015 in reply to Dimiter Madjarov Link to this post

    I followed the example EXACTLY, and added the lines you indicated above...it still only prints the current page.

     (I got rid of the groupings, totals, and changed the model to match my model...but everything else is the same)

    Thoughts?

     

    Grid Code Below:

     

    @(Html.Kendo().Grid<DairyDashboard.MVC.ViewModels.Home.MyHerdViewModel>()
        .Name("grid")
        .HtmlAttributes(new { style = "width: 900px" })
        .Columns(columns =>
        {
            columns.Bound(p => p.AnimalId).Width(300);
        })
        .ToolBar(tools => tools.Excel())
        .Pageable()
        .Sortable()
        .Scrollable()
        .Groupable()
        .Excel(excel => excel
            .FileName("Kendo UI Grid Export.xlsx")
            .AllPages(true)
            .Filterable(true)
            .ProxyURL(Url.Action("Excel_Export_Save", "Home"))
        )
        .Reorderable(r => r.Columns(true))
        .Resizable(r => r.Columns(true))
        .ColumnMenu()
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(30)
                .Read(read => read.Action("Excel_Export_Read", "Home"))
        )
    )

     

     

     

  4. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2311 posts

    Posted 09 Jun 2015 Link to this post

    Hello David,

    The provided sample code seems correct, so I cannot state for sure why only the current page is exported. Please provide small isolated runnable example that I could inspect locally and assist further.

    I am looking forward to hearing from you.

    Regards,
    Dimiter Madjarov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. David
    David avatar
    2 posts
    Member since:
    Jun 2015

    Posted 09 Jun 2015 in reply to Dimiter Madjarov Link to this post

    I was incorrectly setting a page size in my controller action...this was preventing the return of all data.

     

    Issue resolved.

  6. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2311 posts

    Posted 10 Jun 2015 Link to this post

    Hello David,

    Thanks for the update. I am glad the issue is resolved.

    Regards,
    Dimiter Madjarov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top