private SfGrid<Order> DefaultGrid;
public List<Order> Orders { get; set; }
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args)
{
if
(args.Item.Id == "Grid_pdfexport") //Id is
combination of Grid's ID and itemname
{
PdfExportProperties PdfProperties = new PdfExportProperties();
PdfProperties.DataSource =
Orders.Take(10).ToList(); //Here
you can customize your count
await this.DefaultGrid.PdfExport(PdfProperties);
}
}
protected override void OnInitialized()
{
Orders = Enumerable.Range(1, 75).Select(x => new Order()
{
OrderID = 1000 + x,
CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
Freight = 2.1 * x,
OrderDate = DateTime.Now.AddDays(-x),
}).ToList();
}
|