I have a RadzenDataGrid which implements an Master Detail Hierarchy to let the user look after the desired data. This is working fine so far. But when I execute the Reload()-Method on the DataGrid to fetch new data, the whole datagrid is collapsed again which is anoying for the operator.
What is the easiest way to preserve the actual collapsed state of the grid? Not for all time but at least until the whole page reloads, e.g. though navigation.
There is no built-in way to do that however you can use the Expand/Collapse events to track what is expanded, save some unique field value that identifies the data item and later restore the expanded items using the API demonstrated on our hierarchical demos.
I have 2 data grids like a master-detail. When I add a new row to the detail and save, the parent row collapses. After saving data, I keep focus on the current page but couldn't figure it out how to make is stay expanded.
private async Task OnCreateRowDetail(OrderDetailDto? orderDetail)
{
if (orderDetail != null)
{
orderDetailMap = new OrderDetail();
Mapper.Map(orderDetail, orderDetailMap);
// Add the new order detail to the database
var addedOrderDetail = await AddOrderDetailUseCase.ExecuteAsync(orderDetailMap);
Mapper.Map(addedOrderDetail, orderDetail);
// Find the parent order
var parentOrder = GetParentOrder(orderDetail);
if (parentOrder != null)
{
pageIndex = current_page;
_order = ViewOrdersUseCase.Execute();
_ordersDto = Mapper.ProjectTo<OrderDto>(_order);
await _gridDetail.GoToPage((int)pageIndex);
await _grid.ExpandRow(_ordersDto.FirstOrDefault(o => o.Id == parentOrder.Id));
}
}
thanks for your feedback. I tried implementing your suggestion but am struggeling with that. As soon as I subscribe to the RowExpand-Event my expanding doesn't works at all.
The strange thing is that the event gets fired but the expanding doesn't works at all now. There no error displayed it is simply not expanded without any issue. Any suggestions on that case?
I'm sorry but I wasn't able to find any example in your samples using the RowExpanded command. Actually I'm doing nothing but subscribing to the event, but this seems to be enough to break the functionality. It would be really helpfullt to receive a working example using the RowExpand-Event which I can adapt to my own application.
I adapted the example 1:1 to my own application, of course except of the datamodels, where I don't have your source. The behaviour is still the same and seems like a bug to me: When I add RowExpand="RowExpand" to my DataGrid the details view doesn't opens at all. Even if the called handler is empty and does nothing at all. There's no error shown anywhere.
When I remove the RowExpand="RowExpand" the details-view opens up without any issue.
I understand that dedicated support is limited to paid customers usually, but maybe someone else from the community has seen this issue before. And in case this behaviour is really a bug inside of Radzen, I think it makes sense to report it here.
You have full access to our entire source code not only the demos but all components as well and I already suggested you once to debug your app however looks like you are ignoring my posts.