Is there any way to turn off grouping before exporting to excel and then turn it back on. I have tried utilizing the before and after export events but it does not seem to work.
private async Task OnExcelAfterExportAsync(GridAfterExcelExportEventArgs args)
{
await ticketGrid.SetState(currentGridState);
}
private async Task OnExcelBeforeExportAsync(GridBeforeExcelExportEventArgs args)
{
currentGridState = ticketGrid.GetState();
GridState<TicketListModel> tempState = new()
{
SortDescriptors = currentGridState.SortDescriptors,
FilterDescriptors = currentGridState.FilterDescriptors,
GroupDescriptors = new List<GroupDescriptor>()
};
await ticketGrid.SetState(tempState);
args.Columns = args.Columns.Except(args.Columns.Where(c => c.Field == "HasAttachments")).ToList();
var statusColumn = args.Columns.First(c => c.Field == "StatusId");
statusColumn.Field = "Status";
var priorityColumn = args.Columns.First(c => c.Field == "PriorityId");
priorityColumn.Field = "Priority";
var areaColumn = args.Columns.First(c => c.Field == "Area");
areaColumn.Width = "150px";
args.IsCancelled = false;
}