This is a migrated thread and some comments may be shown as answers.

Issue (?) in SelectedItemsChanged

4 Answers 478 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Giampaolo
Top achievements
Rank 1
Veteran
Giampaolo asked on 14 Apr 2020, 04:12 PM

Hi

I have a grid like these

<TelerikGrid Data="@List_GEST_Ordini_Teste_Filtrato" Height="auto"
                 Pageable="true" Sortable="false" Groupable="false" PageSize="20"
                 FilterMode="Telerik.Blazor.GridFilterMode.FilterMenu"
                 Resizable="true" Reorderable="true"
                 SelectionMode="GridSelectionMode.Single"
                 SelectedItemsChanged="@((IEnumerable<ViewListaOrdini> employeeList) => OnSelect(employeeList))">

....

In OnSelect I use the next, to move another page

Navigation.NavigateTo("ordineediting", false);

In 2.9 all works fine, but I've upgraded to 2.10 all stopped to work: OnSelect i called multiple indefinitly

tnx

4 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 14 Apr 2020, 04:57 PM

Hello Giampaolo,

This seems to work fine for me with 2.10.0. Can you confirm that you have upgraded all assets, including JS Interop file (especially if you are using it from the CDN) by following the instructions: https://docs.telerik.com/blazor-ui/upgrade/overview? There was a similar issue (link with details) in 2.9.0 and if the upgrade was not successful, you may still be hitting it.

I am also attaching here two sample apps that seem to work fine for me so you can check if I am missing something and compare against them if they work fine for you. If you can reproduce the issue in either, please post here the needed changes so I can investigate.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Giampaolo
Top achievements
Rank 1
Veteran
answered on 14 Apr 2020, 05:59 PM

Hi

I've found the issue

In attach the example

The problem is that the grid is bound to another list that sub-filter and order items from antoher list.

Very strange: in 2.9 all worked fine, and now we get an error.

I know that this is not the correct way to bind items to list... but it worked.

I'll solve in other mode.

Tnx

0
Giampaolo
Top achievements
Rank 1
Veteran
answered on 14 Apr 2020, 06:01 PM

Excuse me

I cannot attach zip files

 

<TelerikGrid Data=@GridDataToShow

             SelectionMode="GridSelectionMode.Single"
             SelectedItemsChanged="@((IEnumerable<Employee> employeeList) => OnSelect(employeeList))"
             Pageable="true"
             Height="300px">
    <GridColumns>
        <GridColumn Field=@nameof(Employee.Name) />
        <GridColumn Field=@nameof(Employee.Team) Title="Team" />
    </GridColumns>
</TelerikGrid>

@code {
    public List<Employee> GridDataToShow { get {
            return GridData.OrderBy(x=>x.EmployeeId).ToList();


        } }
    public List<Employee> GridData { get; set; }
    public Employee SelectedEmployee { get; set; }

    protected override void OnInitialized()
    {
        GridData = new List<Employee>();
        for (int i = 0; i < 15; i++)
        {
            GridData.Add(new Employee()
            {
                EmployeeId = i,
                Name = "Employee " + i.ToString(),
                Team = "Team " + i % 3
            });
        }
    }
0
Accepted
Marin Bratanov
Telerik team
answered on 15 Apr 2020, 07:10 AM

Hi Giampaolo,

Thank you for getting back to me. It hadn't occurred to me to pre-sort the data.

I made the following page where we can track this issue:https://feedback.telerik.com/blazor/1461863-infinite-loop-in-selecteditemschanged-when-the-grid-is-bound-to-a-pre-filtered-sorted-collection-in-2-10-0. It offers a workaround and the results from the investigation will be posted there - either the release with a fix, or more details on why it won't be handled internally in the grid if that would be the case.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
Giampaolo
Top achievements
Rank 1
Veteran
Answers by
Marin Bratanov
Telerik team
Giampaolo
Top achievements
Rank 1
Veteran
Share this question
or