<SfGrid DataSource="@Orders" ... @ref="Grid" AllowExcelExport="true" AllowPdfExport="true">
<SfToolbar>
<ToolbarItems>
<ToolbarItem Type="ItemType.Input">
<Template>
<SfDropDownList TValue="string" Placeholder="Select Export Types" TItem="string" DataSource=@LocalData Width="200">
<DropDownListEvents TValue="string" TItem="string" ValueChange="OnChange"> </DropDownListEvents>
</SfDropDownList>
</Template>
</ToolbarItem>
</ToolbarItems>
</SfToolbar>
...
</SfGrid>
@code{
SfGrid<Order> Grid;
public List<Order> Orders { get; set; }
List<string> LocalData = new List<string>{ "Excel Export", "Pdf Export" };
...
public async Task OnChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string,string> args)
{
if(args.Value == "Excel Export")
{
await Grid.ExcelExport();
}
if(args.Value == "Pdf Export")
{
await Grid.PdfExport();
}
}
...
}
|
<SfToolbar>
<ToolbarEvents Clicked="ToolbarClickHandler"></ToolbarEvents>
<ToolbarItems>
<ToolbarItem PrefixIcon="e-add e-icons" Text="Add"></ToolbarItem>
<ToolbarItem PrefixIcon="e-delete e-icons" Text="Delete"></ToolbarItem>
<ToolbarItem Type="ItemType.Input">
<Template>
<SfDropDownList TValue="string" Placeholder="Select Export Types" TItem="string" DataSource=@LocalData Width="200">
<DropDownListEvents TValue="string" TItem="string" ValueChange="OnChange"> </DropDownListEvents>
</SfDropDownList>
</Template>
</ToolbarItem>
</ToolbarItems>
</SfToolbar>
|