is it possible to expand the subitem when a row is clicked?
<RadzenGrid @ref="_gridMeasures" AllowFiltering="true" AllowPaging="true" AllowSorting="true"
Data="@(getMeasuresResult)" TItem="Measure" RowSelect="@gridMeasuresRowSelect" RowExpand="@gridMeasuresRowExpand">
<Columns>...</Columns>
<Template Context="data2">
<MeasureEditor Entity="@data2" @ref="_measureEditor" DataChangedAction="DataChangedAction" />
</Template>
</RadzenGrid>
protected async Task gridMeasuresRowSelect(Measure args)
{
// expand row
_gridMeasures.???();
}
1 Like
enchev
March 15, 2020, 5:23am
2
There is no public method for this at the moment however we will add it in the next update.
3 Likes
Has this made it in? I'm trying to make certain rows auto-expand on page load.
Has the ability to expand a row with sub items been made possible yet? Thanks.
HI, exist now some possibilities how to expand row by code?
enchev
August 10, 2020, 5:54am
6
1 Like
Been awhile on this thread. Nevertheless... I ran into same question and this was all I found. Don't think that Demo from radzen covered this (unless I missed something there). I got it working by:
Binding the selected item. E.g.
LoadData="@LoadData"
RowExpand="RowExpand"
ExpandMode="DataGridExpandMode.Single"
@bind-Value=@selectedItems
@onclick="HandleShowItemDetail"
Declaring in code section...
private IList? selectedItems;
Method to trigger the RowExpand...
private async Task HandleShowItemDetail()
{
var itemModel = selectedItems?.FirstOrDefault();
if (itemModel != null)
{
await grid!.ExpandRow(itemModel);
}
}
And then of course the method already triggered when the down carrot is clicked on the left side:
private async Task RowExpand(ItemModel itemModel)
{
if (itemModel.ItemDetail == null)
{
isItemDetailLoading = true;
itemModel.ItemDetail = await itemService.GetItemDetail(itemModel.Id.GetValueOrDefault());
isItemDetailLoading = false;
}
}
I just tried your solution, but it is not working.
So I tried something different. It is so much easier today:
You just need to set in grid:
RowClick="RowClick"
and then add method:
private async Task RowClick(DataGridRowMouseEventArgs mouseClick) {
await _grid!.ExpandRow(mouseClick.Data);
}