Completed
Last Updated: 27 Mar 2020 09:20 by ADMIN
Release 2.10.0
Gary
Created on: 11 Feb 2020 09:31
Category: Grid
Type: Bug Report
1
Using the hierarchy grid, when I select records in the child grid the selection of the parent record changes to match the recordID of the child record.

Simplest repro code is below - expand a few rows and select items in them, or in the parent grid. I would expect that selection in each grid is independent, but the child grid seems to control the parent selection too, even though it is disabled.

 

 

<TelerikGrid Data="salesTeamMembers" PageSize="4" Pageable="true" @bind-SelectedItems="@SelectedItemsMainGrid" SelectionMode="@GridSelectionMode.Single">
    <DetailTemplate>
        @{
            var employee = context as MainModel;
            <TelerikGrid Data="employee.Orders" Pageable="true" PageSize="7" SelectionMode="@GridSelectionMode.None">
                <GridColumns>
                    <GridColumn Field="OrderId"></GridColumn>
                    <GridColumn Field="DealSize"></GridColumn>
                </GridColumns>
            </TelerikGrid>
        }
    </DetailTemplate>
    <GridColumns>
        <GridColumn Field="Id"></GridColumn>
        <GridColumn Field="Name"></GridColumn>
    </GridColumns>
</TelerikGrid>

@foreach (var item in SelectedItemsMainGrid)
{
    <div>@item.Name</div>
}

@code {
    List<MainModel> salesTeamMembers { get; set; }
    public IEnumerable<MainModel> SelectedItemsMainGrid { get; set; } = Enumerable.Empty<MainModel>();

    protected override void OnInitialized()
    {
        salesTeamMembers = GenerateData();
    }

    private List<MainModel> GenerateData()
    {
        List<MainModel> data = new List<MainModel>();
        for (int i = 1; i < 16; i++)
        {
            MainModel mdl = new MainModel { Id = i, Name = $"Name {i}" };
            mdl.Orders = Enumerable.Range(1, 15).Select(x => new DetailsModel { OrderId = x, DealSize = x ^ i }).ToList();
            data.Add(mdl);
        }
        return data;
    }

    public class MainModel
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public List<DetailsModel> Orders { get; set; }
    }

    public class DetailsModel
    {
        public int OrderId { get; set; }
        public double DealSize { get; set; }
    }
}

2 comments
ADMIN
Marin Bratanov
Posted on: 27 Mar 2020 09:20

Thank you for the kind words, Gary :) I will make sure the entire team sees this message :)

--Marin

Gary
Posted on: 26 Mar 2020 14:56
You respond like no company I have ever seen.  I just can't believe it.  But now if you are anything less than amazing, you won't be up to your standard.  You have really screwed yourself by being so good.  LOL