GridCheckBoxColumn: The check disappears when focus is on a editable cell.
<TelerikGrid Class=k-grid
Hi Tom,
The described behavior is caused by the fact that the edited row is a different object instance than the original selected row.
A possible workaround is to:
In the meantime, I will ask our developers to confirm this is a bug and will follow-up.
<TelerikGrid Data="@GridData"
EditMode="@GridEditMode.Incell"
SelectedItems="@SelectedItems"
SelectionMode="GridSelectionMode.Multiple"
SelectedItemsChanged="@( (IEnumerable<Product> items) => SelectedItemsChanged(items) )">
<GridColumns>
<GridCheckboxColumn SelectAll="false" Title="Select" Width="70px" />
<GridColumn Field=@nameof(Product.Name) Editable="false" Title="Product Name" />
<GridColumn Field=@nameof(Product.Price) Title="Price" />
</GridColumns>
</TelerikGrid>
@code {
List<Product> GridData { get; set; }
IEnumerable<Product> SelectedItems { get; set; } = new List<Product>();
async Task SelectedItemsChanged(IEnumerable<Product> items)
{
if (items.Any())
{
SelectedItems = new List<Product>() { items.Last() };
}
else
{
SelectedItems = new List<Product>();
}
}
protected override void OnInitialized()
{
GridData = new List<Product>();
var rnd = new Random();
for (int i = 1; i <= 5; i++)
{
GridData.Add(new Product()
{
ID = i,
Name = "Product " + i.ToString(),
Price = (decimal)rnd.Next(1, 100),
Quantity = (short)rnd.Next(1, 100)
});
}
}
public class Product
{
public int ID { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
public short Quantity { get; set; }
}
}
Regards,
Dimo
Progress Telerik