Completed
Last Updated: 02 Apr 2020 08:21 by ADMIN
Release 2.10.0
NTMLegalSolutions
Created on: 04 Sep 2019 13:58
Category: Grid
Type: Feature Request
20
Frozen Columns in Grid
I would like to request Frozen Columns/Headers in the Data Grid
3 comments
ADMIN
Marin Bratanov
Posted on: 04 Mar 2020 17:01

Thank you for your interest, Viktor.

At this point we don't know how many of Syncfusions's components are still wrappers and whether they have migrated some of them to native components, but what I can say is that the large number of components they came up with is due to all of them being JS wrappers initially. Their documentation still shows them as requiring their JS widgets assets. We, on the other hand, chose to create everything from the ground up as native Blazor components. You can read more about the benefits to that here: https://www.telerik.com/blogs/comparing-native-blazor-components-to-wrapped-javascript-components.

That said, in the meantime, you can put two grids next to each other to use the first as "frozen" columns. The downside is synchronizing scrolling and all the other features (such as sorting, filtering, etc.), but with sufficiently small page sizes you can avoid scrollbars.

Here's a basic example:

<style>
    .grid-holder {
        display: flex;
    }

    .leftGrid {
        flex: 0 0 150px; /* this width must match the first grid width */
    }

        .leftGrid .k-pager-wrap.k-grid-pager {
            height: 47px; /* inspect the other grid pager to see its actual height, it may vary with another theme or site-specific CSS */
        }

            .leftGrid .k-pager-wrap.k-grid-pager * {
                display:none;
            }

    .right-grid {
        flex: 1;
    }
</style>

<div class="grid-holder">
    <div class="leftGrid">
        <TelerikGrid Data="@MyData" Height="@sharedHeight" Width="150px"
                     Pageable="true" @bind-Page="@sharedPage" PageSize="@sharedPageSize">
            <GridColumns>
                <GridColumn Field="@(nameof(SampleData.Id))" />
            </GridColumns>
        </TelerikGrid>
    </div>
    <div class="right-grid">
        <TelerikGrid Data="@MyData" Height="@sharedHeight" Width="400px"
                     Pageable="true" @bind-Page="@sharedPage" PageSize="@sharedPageSize">
            <GridColumns>
                <GridColumn Field="@(nameof(SampleData.Name))" Title="Employee Name" Width="200px" />
                <GridColumn Field="@(nameof(SampleData.Team))" Title="Team" Width="300px" />
                <GridColumn Field="@(nameof(SampleData.HireDate))" Title="Hire Date" Width="1000px" />
            </GridColumns>
        </TelerikGrid>
    </div>
</div>

@code {
    int sharedPage { get; set; }
    int sharedPageSize { get; set; } = 10;
    string sharedHeight { get; set; } = "600px";

    public IEnumerable<SampleData> MyData = Enumerable.Range(1, 30).Select(x => new SampleData
    {
        Id = x,
        Name = "name " + x,
        Team = "team " + x % 5,
        HireDate = DateTime.Now.AddDays(-x).Date
    });

    public class SampleData
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Team { get; set; }
        public DateTime HireDate { get; set; }
    }
}

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
Victor
Posted on: 04 Mar 2020 16:30
The main competitor, Syncfusion, already has this feature, so I would like to see this implemented ASAP.
ADMIN
Marin Bratanov
Posted on: 05 Sep 2019 13:05

Hi,

You can Follow this feature request for status updates on frozen columns.

Frozen headers is something separate that is almost possible at the moment, even though we have not yet implemented scrolling modes for the grid. At this time, setting a Height for the grid will keep the headers visible at all times, and only the data rows will scroll.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor