Declined
Last Updated: 07 Apr 2022 04:11 by ADMIN
Jason
Created on: 08 Jan 2022 13:07
Category: Grid
Type: Bug Report
1
SaveAsCsvFileAsync does not honor AllPages

----

ADMIN EDIT

The Excel export seems to honor it, so it can be used as a workaround.

 

Reproducible with the workaround commented out:

 

<TelerikButton OnClick="@CurrentPage">Current Page</TelerikButton>
<TelerikButton OnClick="@AllPages">All Pages</TelerikButton>

<TelerikGrid Data="@GridData"
             @ref="@GridRef"
             Pageable="true"
             Sortable="true"
             Resizable="true"
             Reorderable="true"
             FilterMode="@GridFilterMode.FilterRow"
             Groupable="true">



    <GridExport>
        <GridExcelExport FileName="telerik-grid-export" AllPages="@ExportAllPages" />
    </GridExport>

    <GridColumns>
        <GridColumn Field="@nameof(SampleData.ProductId)" Title="ID" Width="100px" />
        <GridColumn Field="@nameof(SampleData.ProductName)" Title="Product Name" Width="300px" />
        <GridColumn Field="@nameof(SampleData.UnitsInStock)" Title="In stock" Width="100px" />
        <GridColumn Field="@nameof(SampleData.Price)" Title="Unit Price" Width="200px" />
        <GridColumn Field="@nameof(SampleData.Discontinued)" Title="Discontinued" Width="100px" />
        <GridColumn Field="@nameof(SampleData.FirstReleaseDate)" Title="Release Date" Width="300px" />
    </GridColumns>
</TelerikGrid>

@code {
    async Task AllPages()
    {
        ExportAllPages = true;

        await Task.Delay(20); // allow the component to rerender with the new parameter

        await GridRef.SaveAsCsvFileAsync();

        //await GridRef.SaveAsExcelFileAsync(); // this works
    }

    async Task CurrentPage()
    {
        ExportAllPages = false;

        await Task.Delay(20); // allow the component to rerender with the new parameter

        await GridRef.SaveAsCsvFileAsync();

        //await GridRef.SaveAsExcelFileAsync(); // this works
    }


    private TelerikGrid<SampleData> GridRef { get; set; }


    List<SampleData> GridData { get; set; }
    bool ExportAllPages { get; set; }

    protected override void OnInitialized()
    {
        GridData = Enumerable.Range(1, 100).Select(x => new SampleData
        {
            ProductId = x,
            ProductName = $"Product {x}",
            UnitsInStock = x * 2,
            Price = 3.14159m * x,
            Discontinued = x % 4 == 0,
            FirstReleaseDate = DateTime.Now.AddDays(-x)
        }).ToList();
    }

    public class SampleData
    {
        public int ProductId { get; set; }
        public string ProductName { get; set; }
        public int UnitsInStock { get; set; }
        public decimal Price { get; set; }
        public bool Discontinued { get; set; }
        public DateTime FirstReleaseDate { get; set; }
    }
}

1 comment
ADMIN
Stamo Gochev
Posted on: 07 Apr 2022 04:07

Hello,

The functionality is working OK when the CSV export is configured as expected:

<TelerikGrid>
    <GridExport>       
        <GridCsvExport FileName="csv-export" AllPages="true" />
    </GridExport>
</TelerikGrid>

Here is a working Blazor REPL example:

https://blazorrepl.telerik.com/GQuoaUPw08bO5EHG13

Regards,
Stamo Gochev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.