Hello,
I have a RadzenDataGrid and the columns is dynamic.
How could I get the clicked column when I click a "RadzenDataGrid" row?
Thank you!
<RadzenDataGrid Data="@Data"
TItem="RowType"
ColumnWidth="140px"
RowClick="(arg)=>RowClick(arg)">
<Columns>
@{
//create the columns
for (var i = 0; i < 3; i++)
{
<RadzenDataGridColumn TItem="RowType"
Property=""
Title="@(Columns[i])">
<Template Context="context">
<a href="javascript:void(0);" @onclick="@(()=>TableCellClick1(context))">
<div style="opacity: 0; width:100%; height:20px"></div>
</a>
</Template>
</RadzenDataGridColumn>
}
}
</Columns>
</RadzenDataGrid>
@code {
class RowType
{
public string Article { get; set; }
}
private List<string>
Columns = new List<string>() { "C1", "C2", "C3" };
private List<RowType> Data = new List<RowType>()
{
new RowType() { Article = "001" },
new RowType() { Article = "002"},
};
private void RowClick(DataGridRowMouseEventArgs<RowType> args)
{
}
private async Task TableCellClick1(RowType article)
{
}
}