Completed
Last Updated: 01 Apr 2022 08:13 by ADMIN
Release 3.2.0
Andrew
Created on: 23 Oct 2021 10:08
Category: Grid
Type: Feature Request
2
Grid toolbar SearchBox Width setting

I would like to set increase the searchbox width with a parameter.

---

ADMIN EDIT

Here is a CSS workaround:

 

<style>
    .custom-searchbox-width .k-grid-search {
        width: 50%;
    }
</style>

<TelerikGrid Data=@GridData Pageable="true" Height="400px" Class="custom-searchbox-width">
    <GridToolBar>
        <span class="k-toolbar-spacer"></span> @* add this spacer to keep the searchbox on the right *@
        <GridSearchBox />
    </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>

@code {
    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; }
    }
}

 

---

1 comment
Andrew
Posted on: 23 Oct 2021 10:23
thank you for your assistance.  workaround works fine.