Hey,
I have multiselect datagrid with buttons to show a profile. The problem is as soon as I click on the button the row is selected. How can I fix this problem?
I tried to remove the element from the selectedList and use select method, reload datagrid, reset but nothing worked so far.
For removing from the binded selctedList it updates the shown grid, but a little bit late, only as soon as I click the next element.
Thanks a lot!
Code:
<RadzenDataGrid @ref="employeesGrid" AllowFiltering="true" FilterMode="FilterMode.Simple" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" AllowPaging="true" PageSize="10" AllowSorting="true"
Data="@_employeeList" TItem="Employee" SelectionMode="DataGridSelectionMode.Multiple" @bind-Value=@selectedEmployees>
<Columns>
<RadzenDataGridColumn TItem="Employee" Width="40px" Sortable="false" Filterable="false">
<HeaderTemplate>
<RadzenCheckBox TriState="false" TValue="bool" Value="@(_employeeList.Any(i => selectedEmployees != null && selectedEmployees.Contains(i)))"
Change="@(args => selectedEmployees = args ? _employeeList.ToList() : null)" />
</HeaderTemplate>
<Template Context="data">
<RadzenCheckBox TriState="false" Value="@(selectedEmployees != null && selectedEmployees.Contains(data))" />
</Template>
</RadzenDataGridColumn>
<RadzenDataGridColumn Width="200px" TItem="Employee" Property="Id" Title="Employee Profile" Filterable="false" >
<Template Context="data">
<RadzenButton ButtonStyle="ButtonStyle.Info" Icon="help" Click=@(() => ShowEmployeeDetails(data)) Text="Profile" />
</Template>
</RadzenDataGridColumn>
...
protected async Task ShowEmployeeDetails(Employee emp)
{
var parameters = new ModalParameters();
parameters.Add("Employee", emp);
Modal.Show<EmployeeDetails>("EmployeeDetails", parameters);
//tried to do stuff here to fix it like list.Remove, Select etc.
}