Blazorise DataGrid: Fixed Header

Fixed Header

#
First Name
Last Name
Email
Salary
1SamuelCollier[email protected]86 030,41 €
2IrvinZiemann[email protected]61 781,31 €
3GeraldPollich[email protected]58 810,75 €
4CoraConn[email protected]84 414,66 €
5AlfonsoD'Amore[email protected]69 318,29 €
6JessieWilkinson[email protected]78 566,12 €
7GregoryRenner[email protected]57 456,82 €
8MaryannHilpert[email protected]89 153,38 €
9MerlePacocha[email protected]55 349,94 €
10AngelinaWard[email protected]73 625,86 €
11KaraBrekke[email protected]58 321,87 €
12YvetteFerry[email protected]89 658,90 €
13PabloFriesen[email protected]77 090,27 €
14ErnestHomenick[email protected]54 910,14 €
15LeslieWehner[email protected]78 930,58 €
16MiguelLynch[email protected]65 348,06 €
17TommySwaniawski[email protected]92 326,27 €
18ViolaWilderman[email protected]76 575,00 €
19BrendaJacobson[email protected]86 145,68 €
20RogerHerzog[email protected]53 168,45 €
21CaseyWeber[email protected]56 257,49 €
22TaraSchoen[email protected]72 637,29 €
23AlSanford[email protected]88 870,12 €
24JillStokes[email protected]59 252,89 €
25MarianArmstrong[email protected]69 182,74 €
26JanieStanton[email protected]51 608,79 €
27DixieBlock[email protected]89 653,26 €
28TeresaDietrich[email protected]56 151,34 €
29ReneeHerzog[email protected]93 592,47 €
30DamonLubowitz[email protected]89 271,37 €
31CodyRau[email protected]63 067,69 €
32EthelKassulke[email protected]92 175,30 €
33RudyWalsh[email protected]76 356,17 €
34RossHauck[email protected]51 620,31 €
35OtisLittle[email protected]77 906,94 €
36BenjaminFriesen[email protected]78 343,54 €
37MosesMosciski[email protected]99 202,48 €
38KellieMurazik[email protected]98 314,89 €
39NicholeKeebler[email protected]65 412,00 €
40BobbieRogahn[email protected]52 889,16 €
41CharlieBorer[email protected]50 448,59 €
42LuisRutherford[email protected]83 594,06 €
43JaredPfannerstill[email protected]54 282,76 €
44FloydSatterfield[email protected]59 157,17 €
45ClaudeParker[email protected]58 576,97 €
46DonaldDaugherty[email protected]66 692,86 €
47RolandBruen[email protected]98 404,23 €
48PaulineConroy[email protected]69 674,96 €
49LoraLockman[email protected]74 035,99 €
50JoeyKoelpin[email protected]57 184,86 €
51StaceyGraham[email protected]88 562,39 €
52DaisyMedhurst[email protected]51 011,13 €
53ErinCorwin[email protected]70 013,81 €
54ArturoDenesik[email protected]61 456,56 €
55CherylCollier[email protected]59 868,88 €
56AndresWilliamson[email protected]74 180,71 €
57PhyllisWilderman[email protected]59 518,29 €
58BillyWiza[email protected]92 241,90 €
59WoodrowGibson[email protected]90 288,10 €
60CristinaHarris[email protected]81 762,53 €
61DarleneDaniel[email protected]74 142,55 €
62CourtneyFrami[email protected]68 435,70 €
63MaeFeeney[email protected]65 623,26 €
64JoshDoyle[email protected]87 057,60 €
65GwenAbbott[email protected]65 189,89 €
66MonaBeier[email protected]80 367,71 €
67MinnieCorwin[email protected]78 002,56 €
68DwightRunolfsson[email protected]73 986,40 €
69BethBartell[email protected]85 841,65 €
70SteveSchulist[email protected]94 190,45 €
71PamGreenholt[email protected]75 695,28 €
72DarrelWilliamson[email protected]70 327,72 €
73RolandoSauer[email protected]84 971,22 €
74CesarSchaefer[email protected]92 704,04 €
75LuisLeannon[email protected]61 167,01 €
76FannieWilliamson[email protected]94 194,50 €
77MariannePouros[email protected]71 394,54 €
78SpencerRogahn[email protected]55 993,84 €
79DonnieLuettgen[email protected]77 655,38 €
80BlancaBreitenberg[email protected]75 633,97 €
81PatRohan[email protected]50 151,72 €
82VirginiaKassulke[email protected]77 411,81 €
83LelaBreitenberg[email protected]53 894,64 €
84RandalKoss[email protected]93 602,37 €
85KimberlyChristiansen[email protected]65 089,52 €
86JeanBoyer[email protected]99 805,01 €
87MurielShields[email protected]66 809,95 €
88MarcusEmmerich[email protected]99 401,27 €
89FaithNicolas[email protected]50 439,25 €
90BoydDavis[email protected]58 591,48 €
91WilburStiedemann[email protected]64 479,16 €
92RobertoStracke[email protected]57 007,18 €
93MindySmitham[email protected]56 810,55 €
94DianneMaggio[email protected]73 990,94 €
95MandyBahringer[email protected]69 018,94 €
96MarlonLedner[email protected]72 372,09 €
97LaverneSchuster[email protected]84 767,07 €
98KendraCorkery[email protected]79 303,18 €
99ChrisBarton[email protected]68 642,57 €
100EdPrice[email protected]84 665,20 €
<DataGrid TItem="Employee"
          Data="@employeeList"
          @bind-SelectedRow="@selectedEmployee"
          Responsive
          PageSize="100"
          FixedHeader
          FixedHeaderDataGridMaxHeight="300px">
    <DataGridCommandColumn />
    <DataGridColumn Field="@nameof(Employee.Id)" Caption="#" Sortable="false" />
    <DataGridColumn Field="@nameof(Employee.FirstName)" Caption="First Name" Editable />
    <DataGridColumn Field="@nameof(Employee.LastName)" Caption="Last Name" Editable />
    <DataGridColumn Field="@nameof(Employee.Email)" Caption="Email" Editable />
    <DataGridColumn Field="@nameof(Employee.Salary)" Caption="Salary" DisplayFormat="{0:C}" DisplayFormatProvider="@System.Globalization.CultureInfo.GetCultureInfo("fr-FR")" Editable>
        <EditTemplate>
            <NumericEdit TValue="decimal" Value="@((decimal)context.CellValue)" ValueChanged="@( v => context.CellValue = v)" />
        </EditTemplate>
    </DataGridColumn>
</DataGrid>
@code {
    [Inject]
    public EmployeeData EmployeeData { get; set; }
    private List<Employee> employeeList;
    private Employee selectedEmployee;

    protected override async Task OnInitializedAsync()
    {
        employeeList = await EmployeeData.GetDataAsync();
        await base.OnInitializedAsync();
    }
}

Scroll To

Scroll to API is available when the DataGrid FixedHeader or Virtualize is set.
#
First Name
Last Name
Email
Salary
1SamuelCollier[email protected]86 030,41 €
2IrvinZiemann[email protected]61 781,31 €
3GeraldPollich[email protected]58 810,75 €
4CoraConn[email protected]84 414,66 €
5AlfonsoD'Amore[email protected]69 318,29 €
6JessieWilkinson[email protected]78 566,12 €
7GregoryRenner[email protected]57 456,82 €
8MaryannHilpert[email protected]89 153,38 €
9MerlePacocha[email protected]55 349,94 €
10AngelinaWard[email protected]73 625,86 €
11KaraBrekke[email protected]58 321,87 €
12YvetteFerry[email protected]89 658,90 €
13PabloFriesen[email protected]77 090,27 €
14ErnestHomenick[email protected]54 910,14 €
15LeslieWehner[email protected]78 930,58 €
16MiguelLynch[email protected]65 348,06 €
17TommySwaniawski[email protected]92 326,27 €
18ViolaWilderman[email protected]76 575,00 €
19BrendaJacobson[email protected]86 145,68 €
20RogerHerzog[email protected]53 168,45 €
21CaseyWeber[email protected]56 257,49 €
22TaraSchoen[email protected]72 637,29 €
23AlSanford[email protected]88 870,12 €
24JillStokes[email protected]59 252,89 €
25MarianArmstrong[email protected]69 182,74 €
26JanieStanton[email protected]51 608,79 €
27DixieBlock[email protected]89 653,26 €
28TeresaDietrich[email protected]56 151,34 €
29ReneeHerzog[email protected]93 592,47 €
30DamonLubowitz[email protected]89 271,37 €
31CodyRau[email protected]63 067,69 €
32EthelKassulke[email protected]92 175,30 €
33RudyWalsh[email protected]76 356,17 €
34RossHauck[email protected]51 620,31 €
35OtisLittle[email protected]77 906,94 €
36BenjaminFriesen[email protected]78 343,54 €
37MosesMosciski[email protected]99 202,48 €
38KellieMurazik[email protected]98 314,89 €
39NicholeKeebler[email protected]65 412,00 €
40BobbieRogahn[email protected]52 889,16 €
41CharlieBorer[email protected]50 448,59 €
42LuisRutherford[email protected]83 594,06 €
43JaredPfannerstill[email protected]54 282,76 €
44FloydSatterfield[email protected]59 157,17 €
45ClaudeParker[email protected]58 576,97 €
46DonaldDaugherty[email protected]66 692,86 €
47RolandBruen[email protected]98 404,23 €
48PaulineConroy[email protected]69 674,96 €
49LoraLockman[email protected]74 035,99 €
50JoeyKoelpin[email protected]57 184,86 €
1 - 50 of 499 items
499 items
<Button Size="Size.Small" Color="Color.Primary" Clicked="@ScrollToRow">Scroll To Row</Button>
<Button Size="Size.Small" Color="Color.Primary" Clicked="@ScrollToPixels">Scroll To Pixels</Button>

<DataGrid @ref="dataGridRef"
          TItem="Employee"
          Data="@employeeList"
          @bind-SelectedRow="@selectedEmployee"
          Responsive
          ShowPager
          FixedHeader
          FixedHeaderDataGridMaxHeight="250px"
          PageSize="50">
    <DataGridCommandColumn />
    <DataGridColumn Field="@nameof(Employee.Id)" Caption="#" Sortable="false" />
    <DataGridColumn Field="@nameof(Employee.FirstName)" Caption="First Name" Editable />
    <DataGridColumn Field="@nameof(Employee.LastName)" Caption="Last Name" Editable />
    <DataGridColumn Field="@nameof(Employee.Email)" Caption="Email" Editable />
    <DataGridColumn Field="@nameof(Employee.Salary)" Caption="Salary" DisplayFormat="{0:C}" DisplayFormatProvider="@System.Globalization.CultureInfo.GetCultureInfo("fr-FR")" Editable>
        <EditTemplate>
            <NumericEdit TValue="decimal" Value="@((decimal)context.CellValue)" ValueChanged="@( v => context.CellValue = v)" />
        </EditTemplate>
    </DataGridColumn>
</DataGrid>
@code {
    [Inject]
    public EmployeeData EmployeeData { get; set; }
    private List<Employee> employeeList;
    private Employee selectedEmployee;
    private DataGrid<Employee> dataGridRef;

    protected override async Task OnInitializedAsync()
    {
        employeeList = await EmployeeData.GetDataAsync();
        await base.OnInitializedAsync();
    }

    private Task ScrollToRow()
         => dataGridRef.ScrollToRow(30).AsTask();

    private Task ScrollToPixels()
        => dataGridRef.ScrollToPixels(500).AsTask();
}

API

See the documentation below for a complete reference to all of the props and classes available to the components mentioned here.

On this page