public virtual Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args) { if (args.Item.Id.EndsWith(ExcelExportToolbarItem, StringComparison.InvariantCultureIgnoreCase)) { SfGridRef?.ExcelExport(); } else if (args.Item.Id.EndsWith(RefreshToolbarItem, StringComparison.InvariantCultureIgnoreCase)) { SfGridRef?.Refresh(); } return(Task.CompletedTask); }
protected async Task OnBatchDelete(BeforeBatchDeleteArgs <TItem> args) { try { using (var dbContext = DbContextFactory.CreateDbContext()) { var deletedRecords = await SfGridRef.GetSelectedRecords(); var recordIds = deletedRecords.Select(t => t.Id); dbContext.RemoveRange(dbContext.Set <TItem>().Where(t => recordIds.Contains(t.Id))); await dbContext.SaveChangesAsync(); await SfGridRef.ClearSelection(); } } catch (Exception e) { Serilog.Log.Logger.Error(e, nameof(OnBatchDelete)); } }