Hi the following is not working, I am sure I am missing something very simple?
Nothing happens when i click the tool bar button. No errors, no action nothing.
It does not even reach the console.writeline in the method handler
<SfGrid ID="MyGrid" @ref="sfGridRef" TValue="MyDto" AllowPaging="true" AllowFiltering="true"
AllowSorting="false" Toolbar="@(new List<string>() { "ExcelExport" })" AllowExcelExport="true">
<GridEvents OnToolbarClick="ToolbarClickHandler" TValue="MyDto"></GridEvents>
<SfDataManager
Url=@($"api/{SD.ApiVersion}/reports/odata/letters?year={Year}&clerkname={ClerkName}&clerkposition={ClerkPosition}")
Adaptor="Syncfusion.Blazor.Adaptors.WebApiAdaptor" HttpClientInstance=@(_hc.CreateClient("MyApp"))>
</SfDataManager>
<GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu" />
<GridPageSettings PageSize="@SD.paginationDefaultSize" PageCount="5" PageSizes="true" />
<GridEditSettings />
<GridEvents OnActionFailure="OnGridActionFailure" TValue="MyDto" />
<GridColumns>
<GridColumn Field=@nameof(MyDto.Col1) HeaderText="Col 1" AllowFiltering="false" />
<GridColumn Field=@nameof(MyDto.Col2) HeaderText="Col 2" />
<GridColumn Field=@nameof(MyDto.Col3) HeaderText="Col 3" Format="C2" />
</GridColumns>
</SfGrid>
@code {
private SfGrid<MyDto>? sfGridRef;
private async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args)
{
Console.WriteLine($"*** {args.Item.Id}");
if (args.Item.Id == "MyGrid_excelexport") //Id is combination of Grid's ID and itemname
{
ExcelExportProperties ExcelProperties = new ExcelExportProperties();
ExcelProperties.FileName = $"letters-{DateTime.UtcNow.ToString()}.csv";
if (sfGridRef is not null) await sfGridRef.ExportToCsvAsync(ExcelProperties);
}
}
}
Ok i saw I had two gridevent tags. After combining them I was able to download the file.
I ran into another problem. It only downloads the first page instead of all the records.
Hi Wuss,
Thanks for
the update,
We are happy to hear that the issue you reported has been resolved at your end.
However, you have encountered another problem 'It only downloads the first page
instead of all the records.' We are unable to reproduce the reported issue when
attempting to do so in the latest version 25.1.40.So, to further
proceed with the reporting problem, we require some additional clarification
from your end. Please share the below details to proceed further at our end.
The details requested above will be very helpful in validating the reported query on our end and providing a solution as soon as possible. Thanks for your understanding.
Note: After connecting the database we
need to copy the path of the database and change the connectionstring with the
copied path in OrderContext.cs file based on the NORTHWND.MDF file in APP_Data
folder.
Regards,
Vignesh Natarajan