Completed
Last Updated: 21 Mar 2023 13:38 by ADMIN
Release 4.2.0 (26/04/2023)
Ali
Created on: 07 Dec 2022 12:25
Category: Dialog
Type: Bug Report
2
[Grid in a Dialog] Pressing Escape in a focused SearchBox throws an exception

Pressing Espace in a focused SearchBox throws an "Error: System.ObjectDisposedException: The CancellationTokenSource has been disposed." exception.

<AdminEdit>

A workaround that will solve the issue until the fix is released.

<TelerikDialog @bind-Visible="@Visible"
               Title="@Title">
    <DialogContent>
        <TelerikGrid Data=@GridData Pageable="true" Height="400px" Width="700px">
            <GridToolBar>
                <span class="k-toolbar-spacer"></span> @* add this spacer to keep the searchbox on the right *@
                <div onkeydown="event.stopPropagation()">
                    <GridSearchBox />
                </div>
            </GridToolBar>
            <GridColumns>
                <GridColumn Field="@(nameof(Employee.EmployeeId))" />
                <GridColumn Field=@nameof(Employee.Name) />
                <GridColumn Field=@nameof(Employee.Team) Title="Team" />
                <GridColumn Field=@nameof(Employee.IsOnLeave) Title="On Vacation" />
            </GridColumns>
        </TelerikGrid>
    </DialogContent>
</TelerikDialog>

@code {
    private bool Visible { get; set; } = true;
    private string Title { get; set; } = "Software Update";

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

    protected override void OnInitialized()
    {
        GridData = new List<Employee>();
        var rand = new Random();
        for (int i = 0; i < 15; i++)
        {
            GridData.Add(new Employee()
                {
                    EmployeeId = i,
                    Name = "Employee " + i.ToString(),
                    Team = "Team " + i % 3,
                    IsOnLeave = i % 2 == 0
                });
        }
    }

    public class Employee
    {
        public int EmployeeId { get; set; }
        public string Name { get; set; }
        public string Team { get; set; }
        public bool IsOnLeave { get; set; }
    }
}

 

</AdminEdit>

0 comments