DeepWorks Studios Blazor Component Library

Demo user Administrator ยท Blazor Server Library 20261206222504-6e8ff32.dirty

DwsDataGrid

API Reference

Paged grid basics

A large data set is shown page by page: PageSizeOptions lists the page sizes on offer and InitialPageSize sets the one used at start. When the pagination bar is narrow (on a phone, or with the grid in a slim column), the page buttons collapse into a compact pager with previous, a picker that shows the current page out of the total, and next.

Large Table
Active Name Description Data Type
dzeeiubqgommwahrirwgfmozdoyucgyymsqfkhrfsfymswzvom25.714285Complex
vrkfbtwgozpnaejbgaaqoaobggpcfpchvpxyvfgxjlryxfwvln26Standard
fglnexkkcipyskdfpuvikrrqopoxgqkeqccaqjhiaimbdcwcii26.571428Standard
dnouyojmemyliphdofmnhbeqnltlpxfxuqyplwksyndadrugve26.857143Complex
hyeelkvjimdhestuldcxwodalkvowlxbpoqzsccecnsetlyhiu27.428572Complex
ltvdtbphmwocspctcjbxviwyhzmnfbtobcdxepiapubvqqtifp27.714285Standard
tquwofmlumbsscdkfgtlpviqirbchhqdcafvgetnczsgpaxmam28.285715Standard
qyhdnxekemwyqsxhdbngipccbhtocvmwrejgndqwisvfkqjfps28.571428Complex
ixgznriqrxwgivuahlyayffhqhbzralekbdsbkukccanqzcndv29.142857Complex
qcszjgpiyrmswhsczwqoywesqrenvviytbkaacboutdiayduvb29.428572Standard
cebchqerksdtlacgqbdmpbyrverfmpuaqivmozsdevhnxgbafq30Standard
ebgjhdyyeuycdcfprriaittltpdravdvefetgfrpfgrnpvczvp30.285715Complex
abibyqfwkoliyowezxwacwutkjbidmekngjallnzttntwmoihw30.857143Complex
vdgoqooxtxkavrfwtnjxgjjbxxvtahbuvskgtwuykwaqjwrwdl31.142857Standard
fdebnqmtfhhqucximnrrfxkuyxkrjlfzbgwbukaooljshdznrh31.714285Standard
ihtjdpgvkubipnfvocncdtornuywzbuklqypikhkitboryoliv32Complex
qyvsbieewrbuowqgufqxkwlakzmpqwvrlyjjndfetobgqvmfzp32.57143Complex
uumvibwpnzwkipnhsrzldwufkpngqbasrpeowsvdieackfmwsr32.857143Standard
ltcjmgpybahdppvflvtshkuhnorifurilhreeecbnqqegarwyf33.42857Standard
abzuvyohshjzsiyragsrfqtpbnwujzmffvgpfjidngxjvghiyh33.714287Complex
glrxqydnwvykqamecqbymkqowbiugigghinzgjfrwoxnfdcmyd34.285713Complex
rvucboqihnordhmmysljcymcityvvcvcudrredhqangjzozval34.57143Standard
tnagozpmzdhqcgzqmwkludopkqdtxqgmslxnycykknfwubkkap35.142857Standard
dpylvxvvpjxvxrilsjyabhysvjgstiwzmvhhomgaopywyyesco35.42857Complex
nkmpnshdmwwzixexkohiozysstidfpmtgeynaaufngzrukrrxk36Complex
xomuxtjexwkdsdyqxktcvhzgxhbqfuzijjhkafdavjjdgrsnth36.285713Standard
aqqrfradvavedscesuiskdbsqvhfxsgkthbpbdprnehkkaafgm36.857143Standard
gxpybkjvgctklwrndofqffvqhpucylgkxmaezcceisxfqapeot37.142857Complex
ooslyjlytqsnqnovknpulhqgguujinawwdlwirbcgqhfjwpzcm37.714287Complex
egxlfepbqgpwqncrntmmnualxjevgvwjefyeywmxneabpmgcxk38Standard
gupiresyvzxkctjbaikqrfzogmqipzepinshxpudxyxjhhgalk38.57143Standard
ybuabenkjwvibpbcdkogsthqhzgqxeavrjoqmwoppnpbnygqzi38.857143Complex
zcbobkjjfyhjzqqqohdkixesbpbeycvxvfbzhhhschncduoqxz39.42857Complex
mbxjnmjekcckotoqihakibkcpgakgzdlapszbyuvjywkztgubh39.714287Standard
kohqtxhfqycpqvitgiezwrispunrlvfbeweczsmhfdtcivsnza40.285713Standard
isfobzkpuusbktqftnvxtsyfjtczslouyyomwlqnwqjykglywt40.57143Complex
digvebathydktizhnmbosokjgjyhllnhaxqdrwseiweuwitvbl41.142857Complex
opyxoudsivkvjvrvpquxgvjpmyqdgzgqmtjbfuixbpoijbyxef41.42857Standard
dkkeczpmamfwgwyuttlpftnchqusfkkbmikhgrtjcgaqzxivjr42Standard
zjwixmfxgqbdjxlroczbmzsxckhyjoqolvjakxthefzkovnljr42.285713Complex
rwaiqzqjrxhavvweauacqzqswhdxzqfypnfvjcvrptftakfids42.857143Complex
nrfhljwtjarikhpavyzimxtwsmbuuhsonizopbqlvwjfcrzytc43.142857Standard
pecjopndzirpgloylejqjttgrweonjzjastjggrweatopirkjr43.714287Standard
vwkvsslyqqiiooreremmlizeqietfvcnqxwxykozlfjdghtdte44Complex
ejoaivunsranhijhtnalbiujgmtnpacaobfxvzkkkyauocehsd44.57143Complex
kvpeuvbgxsozzfcmltdqbdizvdimvltshnqkhreoidaifpdyfg44.857143Standard
vcemwdreiwsqloxeunlaoofnqkjhztnuktimfkufwwkvwsxiue45.42857Standard
dhwqvltjeojxgsglzjsgesdjrxnbmuaziopapopjlnrwmymecj45.714287Complex
kbkvpgmpttvwfmwyitvdycatzukrgcoucssuubmjfvzxmmxwyd46.285713Complex
nhbqwvvviqfatntbeghmxcdchmwosdotvrfktdfqnjnisltkcw46.57143Standard
nzvknoqmvfawfwymcmifysgfoeocksigzivdzvieeflbjjajsp47.142857Standard
yvsqvizoccxtwxbungedbtgfwfdfjuchqyjzljazfqdjepmdix47.42857Complex
Show Code
DataGrid.razor
@inject IDwsSnackbarNotificationService SnackbarNotification


<DwsDataGrid Name="DataGridDemo_BaseGrid" T="ExampleDataElement" Items="@_elementsForExample2" Title="Large Table" PageSizeOptions="@_pageSizeOptionList" InitialPageSize="52">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoBaseGrid_Column_ID" T="ExampleDataElement" Field="ID" Title="ID" Hidden="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGrid_Column_Active" T="ExampleDataElement" Field="Active" Title="Active" Sortable="true" Alignment="DwsHorizontalAlignment.Center">
            <CellTemplate>
                <DwsIcon Name="@($"DataGridDemoBaseGrid_Column_ActiveIcon_{context.Item.ID}")" Class="datagrid_i" Icon="@(context.Item.Active ? @Icons.BS.CheckLg: @Icons.BS.Circle)" Color="@(context.Item.Active ? DwsColor.Success: DwsColor.Text)" Size="DwsSize.Medium"></DwsIcon>
            </CellTemplate>
        </DwsDataGridColumn>
        <DwsDataGridColumn Name="DataGridDemoBaseGrid_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" Sortable="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGrid_Column_Descript" T="ExampleDataElement" Field="Description" Title="Description" Sortable="true" VisibilityBreakpoint="DwsVisibilityBreakpoint.XL" />
        <DwsDataGridColumn Name="DataGridDemoBaseGrid_Column_Data" T="ExampleDataElement" Field="MyFloat" Title="Data" Sortable="true" Alignment="DwsHorizontalAlignment.Right" />
        <DwsDataGridColumn Name="DataGridDemoBaseGrid_Column_Type" T="ExampleDataElement" Field="Type" Title="Type" Sortable="true" Alignment="DwsHorizontalAlignment.Center" />
        <DwsDataGridColumn Name="DataGridDemoBaseGrid_Column_Delete" T="ExampleDataElement">
            <CellTemplate>
                <DwsButton Name="@($"DataGridDemBaseGrido_Delete_{context.Item.ID}")" Appearance="DwsAppearance.Icon" ButtonSize="DwsSize.Medium" Icon="@Icons.BS.Trash" Tooltip="Delete" OnClick="@(() => ButtonAction(@context.Item))" />
            </CellTemplate>
        </DwsDataGridColumn>
    </DwsDataGridColumns>
</DwsDataGrid>
DataGrid.razor.cs

private static readonly List<int> _pageSizeOptionList = new() { 23, 52, 101 };
private List<ExampleDataElement> _elementsForExample2 = ExampleDataElement.GenerateExampleList(330);

private void ButtonAction(ExampleDataElement item)
{
    SnackbarNotification.ShowSnackbar(item.Name, DwsSnackbarLevel.Info, "ButtonAction");
}

private DwsContextMenu? _rowMenu;

private static string RowMenuButtonId(ExampleDataElement item) => $"datagrid-demo-rowmenu-{item.ID}";

private List<DwsContextMenuItem> RowMenuItems =>
[
    new() { Text = "Edit content", Icon = Icons.BS.Pencil },
    new() { Text = "Edit general settings", Icon = Icons.BS.Gear },
    DwsContextMenuItem.Separator(),
    new() { Text = "Delete", Icon = Icons.BS.Trash, Color = DwsColor.Error },
];

// TargetData is the row's ID, handed over by ShowAtElementAsync.
private void RowMenuItemClick(DwsContextMenuItemClickEventArgs args) =>
    SnackbarNotification.ShowSnackbar($"{args.Item.Text}: #{args.TargetData}", DwsSnackbarLevel.Info, "RowMenu");

Grid without a card frame (Inline)

Set Inline to drop the card frame around the grid, so that it fits into other content.

Table Name
ActiveNameDataTypeCreated
ynghynyhvq6Standard12/31/2025 12:00:00 PM
ikaoovrlqb6.285714Complex1/8/2026 12:00:00 PM
urckjzeeyh6.571429Standard1/5/2026 12:00:00 PM
ldbxtfbcox6.857143Complex12/30/2025 12:00:00 PM
ghldzxthbi7.142857Standard1/6/2026 12:00:00 PM
efnvugjdnw7.428571Complex1/6/2026 12:00:00 PM
sczxbezepn7.714286Standard1/5/2026 12:00:00 PM
jbsttnfmod8Complex1/5/2026 12:00:00 PM
ssbolrtbww8.285714Standard12/23/2025 12:00:00 PM
qwkmszdqid8.571428Complex1/13/2026 12:00:00 PM
sngmlnxvad8.857142Standard12/27/2025 12:00:00 PM
ghfvoeqpyb9.142858Complex12/30/2025 12:00:00 PM
sfsojkafqj9.428572Standard1/8/2026 12:00:00 PM
xqhwqnqfed9.714286Complex12/21/2025 12:00:00 PM
ykiaadlgrv10Standard12/20/2025 12:00:00 PM
jmercqhvep10.285714Complex1/9/2026 12:00:00 PM
ekkkvwgccl10.571428Standard12/27/2025 12:00:00 PM
wptdqhvmpc10.857142Complex12/24/2025 12:00:00 PM
bqiagfjspg11.142858Standard12/25/2025 12:00:00 PM
jtrhjegezg11.428572Complex12/17/2025 12:00:00 PM
xykqtehwsm11.714286Standard1/8/2026 12:00:00 PM
imcuvfuofl12Complex1/14/2026 12:00:00 PM
smulhywndo12.285714Standard1/8/2026 12:00:00 PM
kdgnymrbql12.571428Complex12/17/2025 12:00:00 PM
uhbafvwusb12.857142Standard12/26/2025 12:00:00 PM
Show Code
DataGrid.razor

<DwsDataGrid Name="DataGridDemo_InlineGrid" T="ExampleDataElement" Items="@_elementsForExample3" Title="Table Name" Searchable="false" Inline="true">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoInlineGrid_Column_Active" T="ExampleDataElement" Field="Active" Title="Active" Sortable="true" Searchable="true" Alignment="DwsHorizontalAlignment.Center">
            <CellTemplate>
                <DwsIcon Name="@($"DataGridDemoInlineGrid_Column_ActiveIcon_{context.Item.ID}")" Class="datagrid_i" Icon="@(context.Item.Active ? @Icons.BS.CheckLg: @Icons.BS.Circle)" Color="@(context.Item.Active ? DwsColor.Success: DwsColor.Text)" Size="DwsSize.Medium"></DwsIcon>
            </CellTemplate>
        </DwsDataGridColumn>
        <DwsDataGridColumn Name="DataGridDemoInlineGrid_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" Sortable="true" Searchable="true" />
        <DwsDataGridColumn Name="DataGridDemoInlineGrid_Column_Data" T="ExampleDataElement" Field="MyFloat" Title="Data" Sortable="true" Searchable="true" Alignment="DwsHorizontalAlignment.Right" />
        <DwsDataGridColumn Name="DataGridDemoInlineGrid_Column_Type" T="ExampleDataElement" Field="Type" Title="Type" Sortable="true" Searchable="true" Alignment="DwsHorizontalAlignment.Center" />
        <DwsDataGridColumn Name="DataGridDemoInlineGrid_Column_CreatedAt" T="ExampleDataElement" Field="CreatedAt" Title="Created" Sortable="true" Searchable="true" Alignment="DwsHorizontalAlignment.Center" />
    </DwsDataGridColumns>
</DwsDataGrid>
DataGrid.razor.cs

private List<ExampleDataElement> _elementsForExample3 = ExampleDataElement.GenerateExampleList(500);

Your own empty state

When the grid has no rows, EmptyStateContent is shown in place of the default text.

Grid without any rows
Name
There are no records to show yet.
Show Code
DataGrid.razor

<DwsDataGrid Name="DataGridDemo_EmptyGrid" T="ExampleDataElement" Items="@_elementsForExampleEmpty" Title="Grid without any rows">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoEmptyGrid_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" />
    </DwsDataGridColumns>
    <EmptyStateContent>
        <div class="d-flex justify-content-center align-items-center py-4">
            <DwsIcon Name="DataGridDemoEmptyGrid_EmptyIcon" Icon="@Icons.BS.InboxFill" Class="me-2" Size="DwsSize.Medium" />
            <span>There are no records to show yet.</span>
        </div>
    </EmptyStateContent>
</DwsDataGrid>
DataGrid.razor.cs

private readonly List<ExampleDataElement> _elementsForExampleEmpty = new();

Fixed maximum height

MaxHeight caps the height of the grid in px; the header stays in place while the rows scroll beneath it.

Large Table
ActiveNameDescriptionDataType
dqlzfytzuzkcmdzdpppcrvtibureswajzgwbkhwivkyqxkpqkv6Standard
hiwdykhphyyacfhxththggwdkqeauwcoyhzoegilbgczrwhjim6.285714Complex
maltsiggvlwjcvgssmzhgaexmoiurhtrwtvzdloaeukrdhtmdq6.571429Standard
ylvngdzmoorfnjagphxzdlpnuevwqbodflvjdpelasfwzxtklx6.857143Complex
hmwitcidvnzoacnrcaclykgtowkkktbbkseimvwcdxxswkxrwu7.142857Standard
nxgduwrxsblyehxfehezibnnwdysopzbscegcjbzlfevgygqtr7.428571Complex
ymjsgrxyjdcjgbdrdufeodwrhywizwzlgherxjdkbnvbswsfnc7.714286Standard
vuprliupzmdrdyxlttrvdbhvzkfrvwiedpljbfyupmnixbtuib8Complex
nunusacduddznnmnjovwgrnyxxqljtnoarbrwhmxrmrkfynfiu8.285714Standard
fwhoxujrtaqpzwmvrccxeuzctzklcpbsptlfjhkrnasqupzrtn8.571428Complex
clxeuykypezxafkhljskjeciiezsspmlanqahenlgpknrxothm8.857142Standard
rxjpwqysgzsownpjzgwgdutpqlpgkfntntvsrsixnojlucabex9.142858Complex
dxeuylarhalybdrwsgyzspliuokncntswvpyowuwwvgiavbwkh9.428572Standard
zolwzjanpuhtbfoshvmbdwiciymoduinvzwbnsxkwigmbhuvir9.714286Complex
ucfiobxmjvltxcjnfpycfuqvbbergmuauzfuveevnjykbhjrlu10Standard
qzlkgmxfgxalzxwprakdovvfttrmflakqdjgilxryhdbjqhlvw10.285714Complex
budfqmvlzuwquwoqggctfhsuwdmfqjipkjbpccvkwmiietvlxf10.571428Standard
bucjjmapuqmhgluyndlrxsyjqchailtlheignttikgsswxnkry10.857142Complex
iiwssgfagiwazbcnlukchqzgmtpwjjuharvzkubmdjzkvwxlid11.142858Standard
hsjpgzriqxnpahgdcrsxzyqpkqvdogwxfrjcqvnbvvscwgwqfe11.428572Complex
jjcueqdntkaqjixdnhdrcefoseufyjfasbhaavqxyibhbgwnsc11.714286Standard
bedocawxpjfaxhaxcrrgsucxmlhhnvrmjfadwmtqbasscbipmu12Complex
uhcgbqspktrtqshxbpybfsbkvldsusvrkylsbqlcxlqzajkqho12.285714Standard
fcgrkqnauryaisgowlevdtccjmamkgzlpksjmjfvpxryaabsjt12.571428Complex
wmzdhypapnsnlxzxcnfjfgbdbjlhdrpqehogjjchfphdfnpesl12.857142Standard
bpkwbynhxyybidisotkydqzxyntgprakohgywnhetxrifdfmvz13.142858Complex
tlqmxoegsgyonaxkwbmgegyrsuihlptcqkouikpszneljrqepl13.428572Standard
znnztdfwudmvxdmcbmltgqbmhbeesamwrdkbhjqlndtbyoumrm13.714286Complex
gilasszbetrpetslusvzfdxaoshrmfrvlzxbphqymmyzkijatg14Standard
mcllmzkhozcwefvrvnbxmteypfigxfnaaamuqevrnfxzwoeefc14.285714Complex
ytymvgqekjmcvdtbaqskkhvebbaebvuildbswdjoaiunnusble14.571428Standard
mqxuktgmdopdqsbafxhejcmhqhjzsxtzvgqlvbsqhofgykdzzl14.857142Complex
vkdpddjhtgvpijbqederwvwgjgdkzhxpmnlghfypgauzkjbtxj15.142858Standard
mznxgwzzhmifdvxvjyepkvaxvzejmqabqpbmtjzbpgsiqfggwc15.428572Complex
lqypbgspnrmgonulczzczedsgqtxnkpskgekndisjatavkqtmk15.714286Standard
khmgilnubdbuviijyyqgszkcxwzaldkojvwwyhuwfpyqyboikd16Complex
vkwkjmlmiysmlallkrdtadbudvhrqhrifgzmaoyhltgzxmqowy16.285715Standard
bsjbgnfuwbhkheazlwsvihwbxresurovloehcyhkbqwfrnelox16.571428Complex
huwhepinaemlysaswmpiuskqjkntdwettjhkluusboqstgollw16.857143Standard
hpjfxtbpkdztrplphbrxgfcsxdvbhgvdnabsafxaqmdmsaoyav17.142857Complex
nbnqiuxaidiwfrnsobeqgucpawpxblswuemafkxcdqdzewuwkh17.428572Standard
ctzxqleayxllbbenneebnqqcldcsmtefbbbtaiulxcrgosusrx17.714285Complex
flcwlmimoetgkzalnfksdlzjotjjapzbxiwqrewhdlnmnihusg18Standard
ptmsirdzlzfribdjtiicprxmwgmoruekjitcdyveedaohwzfri18.285715Complex
zxwzwbfohquuiaiafvnexlrifahgwihdetivfecuyqwjumnzxq18.571428Standard
snfotwuzrzjqqornvbssghphosmhjgfqpcbvprkgzyyxadwyhj18.857143Complex
vkxyabjmqlttannvxdqmshjshkwnazkerugqxrrjwnimehdikl19.142857Standard
cobfqpewmraobghxyflgqfywoahncomstfrsosbbeaarlpfwbn19.428572Complex
vwperqirtyeivwooigejcqehkyuklpafmpjuckaktngcmdujhm19.714285Standard
cfshtsvyfexzwfmumyftqojbugekczkscpndcuqiouibfnhown20Complex
gnwqmmnlvguexgsjrrhwevghwhzqopzdqsizhmhdvdzbhbqavn20.285715Standard
fkgoufnxwggqoeysbfjebaweavryuatqejmxttrcpyhsvqmlcc20.571428Complex
Show Code
DataGrid.razor
@inject IDwsSnackbarNotificationService SnackbarNotification


<DwsDataGrid Name="DataGridDemo_BaseGridSizeHeight" T="ExampleDataElement" Items="@_elementsForExample2" Title="Large Table" MaxHeight="500" PageSizeOptions="@_pageSizeOptionList" InitialPageSize="52">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeHeight_Column_ID" T="ExampleDataElement" Field="ID" Title="ID" Hidden="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeHeight_Column_Active" T="ExampleDataElement" Field="Active" Title="Active" Sortable="true" Alignment="DwsHorizontalAlignment.Center">
            <CellTemplate>
                <DwsIcon Name="@($"DataGridDemoBaseGridSizeHeight_Column_ActiveIcon_{context.Item.ID}")" Class="datagrid_i" Icon="@(context.Item.Active ? @Icons.BS.CheckLg: @Icons.BS.Circle)" Color="@(context.Item.Active ? DwsColor.Success: DwsColor.Text)" Size="DwsSize.Medium"></DwsIcon>
            </CellTemplate>
        </DwsDataGridColumn>
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeHeight_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" Sortable="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeHeight_Column_Descript" T="ExampleDataElement" Field="Description" Title="Description" Sortable="true" VisibilityBreakpoint="DwsVisibilityBreakpoint.XL" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeHeight_Column_Data" T="ExampleDataElement" Field="MyFloat" Title="Data" Sortable="true" Alignment="DwsHorizontalAlignment.Right" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeHeight_Column_Type" T="ExampleDataElement" Field="Type" Title="Type" Sortable="true" Alignment="DwsHorizontalAlignment.Center" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeHeight_Column_Delete" T="ExampleDataElement">
            <CellTemplate>
                <DwsButton Name="@($"DataGridDemBaseGridSizeHeight_Delete_{context.Item.ID}")" Appearance="DwsAppearance.Icon" ButtonSize="DwsSize.Medium" Icon="@Icons.BS.Trash" Tooltip="Delete" OnClick="@(() => ButtonAction(@context.Item))" />
            </CellTemplate>
        </DwsDataGridColumn>
    </DwsDataGridColumns>
</DwsDataGrid>
DataGrid.razor.cs

private static readonly List<int> _pageSizeOptionList = new() { 23, 52, 101 };
private List<ExampleDataElement> _elementsForExample2 = ExampleDataElement.GenerateExampleList(330);

private void ButtonAction(ExampleDataElement item)
{
    SnackbarNotification.ShowSnackbar(item.Name, DwsSnackbarLevel.Info, "ButtonAction");
}

private DwsContextMenu? _rowMenu;

private static string RowMenuButtonId(ExampleDataElement item) => $"datagrid-demo-rowmenu-{item.ID}";

private List<DwsContextMenuItem> RowMenuItems =>
[
    new() { Text = "Edit content", Icon = Icons.BS.Pencil },
    new() { Text = "Edit general settings", Icon = Icons.BS.Gear },
    DwsContextMenuItem.Separator(),
    new() { Text = "Delete", Icon = Icons.BS.Trash, Color = DwsColor.Error },
];

// TargetData is the row's ID, handed over by ShowAtElementAsync.
private void RowMenuItemClick(DwsContextMenuItemClickEventArgs args) =>
    SnackbarNotification.ShowSnackbar($"{args.Item.Text}: #{args.TargetData}", DwsSnackbarLevel.Info, "RowMenu");

Fixed maximum width

MaxWidth caps the width of the grid in px, and the table scrolls sideways.

Large Table
ActiveNameDescriptionDataType
dqlzfytzuzkcmdzdpppcrvtibureswajzgwbkhwivkyqxkpqkv6Standard
hiwdykhphyyacfhxththggwdkqeauwcoyhzoegilbgczrwhjim6.285714Complex
maltsiggvlwjcvgssmzhgaexmoiurhtrwtvzdloaeukrdhtmdq6.571429Standard
ylvngdzmoorfnjagphxzdlpnuevwqbodflvjdpelasfwzxtklx6.857143Complex
hmwitcidvnzoacnrcaclykgtowkkktbbkseimvwcdxxswkxrwu7.142857Standard
nxgduwrxsblyehxfehezibnnwdysopzbscegcjbzlfevgygqtr7.428571Complex
ymjsgrxyjdcjgbdrdufeodwrhywizwzlgherxjdkbnvbswsfnc7.714286Standard
vuprliupzmdrdyxlttrvdbhvzkfrvwiedpljbfyupmnixbtuib8Complex
nunusacduddznnmnjovwgrnyxxqljtnoarbrwhmxrmrkfynfiu8.285714Standard
fwhoxujrtaqpzwmvrccxeuzctzklcpbsptlfjhkrnasqupzrtn8.571428Complex
clxeuykypezxafkhljskjeciiezsspmlanqahenlgpknrxothm8.857142Standard
rxjpwqysgzsownpjzgwgdutpqlpgkfntntvsrsixnojlucabex9.142858Complex
dxeuylarhalybdrwsgyzspliuokncntswvpyowuwwvgiavbwkh9.428572Standard
zolwzjanpuhtbfoshvmbdwiciymoduinvzwbnsxkwigmbhuvir9.714286Complex
ucfiobxmjvltxcjnfpycfuqvbbergmuauzfuveevnjykbhjrlu10Standard
qzlkgmxfgxalzxwprakdovvfttrmflakqdjgilxryhdbjqhlvw10.285714Complex
budfqmvlzuwquwoqggctfhsuwdmfqjipkjbpccvkwmiietvlxf10.571428Standard
bucjjmapuqmhgluyndlrxsyjqchailtlheignttikgsswxnkry10.857142Complex
iiwssgfagiwazbcnlukchqzgmtpwjjuharvzkubmdjzkvwxlid11.142858Standard
hsjpgzriqxnpahgdcrsxzyqpkqvdogwxfrjcqvnbvvscwgwqfe11.428572Complex
jjcueqdntkaqjixdnhdrcefoseufyjfasbhaavqxyibhbgwnsc11.714286Standard
bedocawxpjfaxhaxcrrgsucxmlhhnvrmjfadwmtqbasscbipmu12Complex
uhcgbqspktrtqshxbpybfsbkvldsusvrkylsbqlcxlqzajkqho12.285714Standard
fcgrkqnauryaisgowlevdtccjmamkgzlpksjmjfvpxryaabsjt12.571428Complex
wmzdhypapnsnlxzxcnfjfgbdbjlhdrpqehogjjchfphdfnpesl12.857142Standard
bpkwbynhxyybidisotkydqzxyntgprakohgywnhetxrifdfmvz13.142858Complex
tlqmxoegsgyonaxkwbmgegyrsuihlptcqkouikpszneljrqepl13.428572Standard
znnztdfwudmvxdmcbmltgqbmhbeesamwrdkbhjqlndtbyoumrm13.714286Complex
gilasszbetrpetslusvzfdxaoshrmfrvlzxbphqymmyzkijatg14Standard
mcllmzkhozcwefvrvnbxmteypfigxfnaaamuqevrnfxzwoeefc14.285714Complex
ytymvgqekjmcvdtbaqskkhvebbaebvuildbswdjoaiunnusble14.571428Standard
mqxuktgmdopdqsbafxhejcmhqhjzsxtzvgqlvbsqhofgykdzzl14.857142Complex
vkdpddjhtgvpijbqederwvwgjgdkzhxpmnlghfypgauzkjbtxj15.142858Standard
mznxgwzzhmifdvxvjyepkvaxvzejmqabqpbmtjzbpgsiqfggwc15.428572Complex
lqypbgspnrmgonulczzczedsgqtxnkpskgekndisjatavkqtmk15.714286Standard
khmgilnubdbuviijyyqgszkcxwzaldkojvwwyhuwfpyqyboikd16Complex
vkwkjmlmiysmlallkrdtadbudvhrqhrifgzmaoyhltgzxmqowy16.285715Standard
bsjbgnfuwbhkheazlwsvihwbxresurovloehcyhkbqwfrnelox16.571428Complex
huwhepinaemlysaswmpiuskqjkntdwettjhkluusboqstgollw16.857143Standard
hpjfxtbpkdztrplphbrxgfcsxdvbhgvdnabsafxaqmdmsaoyav17.142857Complex
nbnqiuxaidiwfrnsobeqgucpawpxblswuemafkxcdqdzewuwkh17.428572Standard
ctzxqleayxllbbenneebnqqcldcsmtefbbbtaiulxcrgosusrx17.714285Complex
flcwlmimoetgkzalnfksdlzjotjjapzbxiwqrewhdlnmnihusg18Standard
ptmsirdzlzfribdjtiicprxmwgmoruekjitcdyveedaohwzfri18.285715Complex
zxwzwbfohquuiaiafvnexlrifahgwihdetivfecuyqwjumnzxq18.571428Standard
snfotwuzrzjqqornvbssghphosmhjgfqpcbvprkgzyyxadwyhj18.857143Complex
vkxyabjmqlttannvxdqmshjshkwnazkerugqxrrjwnimehdikl19.142857Standard
cobfqpewmraobghxyflgqfywoahncomstfrsosbbeaarlpfwbn19.428572Complex
vwperqirtyeivwooigejcqehkyuklpafmpjuckaktngcmdujhm19.714285Standard
cfshtsvyfexzwfmumyftqojbugekczkscpndcuqiouibfnhown20Complex
gnwqmmnlvguexgsjrrhwevghwhzqopzdqsizhmhdvdzbhbqavn20.285715Standard
fkgoufnxwggqoeysbfjebaweavryuatqejmxttrcpyhsvqmlcc20.571428Complex
Show Code
DataGrid.razor
@inject IDwsSnackbarNotificationService SnackbarNotification


<DwsDataGrid Name="DataGridDemo_BaseGridSizeWidth1" T="ExampleDataElement" Items="@_elementsForExample2" Title="Large Table" MaxWidth="450" PageSizeOptions="@_pageSizeOptionList" InitialPageSize="52">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeWidth1_Column_ID" T="ExampleDataElement" Field="ID" Title="ID" Hidden="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeWidth1_Column_Active" T="ExampleDataElement" Field="Active" Title="Active" Sortable="true" Alignment="DwsHorizontalAlignment.Center">
            <CellTemplate>
                <DwsIcon Name="@($"DataGridDemoBaseGridSizeWidth1_Column_ActiveIcon_{context.Item.ID}")" Class="datagrid_i" Icon="@(context.Item.Active ? @Icons.BS.CheckLg: @Icons.BS.Circle)" Color="@(context.Item.Active ? DwsColor.Success: DwsColor.Text)" Size="DwsSize.Medium"></DwsIcon>
            </CellTemplate>
        </DwsDataGridColumn>
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeWidth1_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" Sortable="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeWidth1_Column_Descript" T="ExampleDataElement" Field="Description" Title="Description" Sortable="true" VisibilityBreakpoint="DwsVisibilityBreakpoint.XL" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeWidth1_Column_Data" T="ExampleDataElement" Field="MyFloat" Title="Data" Sortable="true" Alignment="DwsHorizontalAlignment.Right" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeWidth1_Column_Type" T="ExampleDataElement" Field="Type" Title="Type" Sortable="true" Alignment="DwsHorizontalAlignment.Center" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeWidth1_Column_Delete" T="ExampleDataElement">
            <CellTemplate>
                <DwsButton Name="@($"DataGridDemBaseGridSizeWidth1_Delete_{context.Item.ID}")" Appearance="DwsAppearance.Icon" ButtonSize="DwsSize.Medium" Icon="@Icons.BS.Trash" Tooltip="Delete" OnClick="@(() => ButtonAction(@context.Item))" />
            </CellTemplate>
        </DwsDataGridColumn>
    </DwsDataGridColumns>
</DwsDataGrid>
DataGrid.razor.cs

private static readonly List<int> _pageSizeOptionList = new() { 23, 52, 101 };
private List<ExampleDataElement> _elementsForExample2 = ExampleDataElement.GenerateExampleList(330);

private void ButtonAction(ExampleDataElement item)
{
    SnackbarNotification.ShowSnackbar(item.Name, DwsSnackbarLevel.Info, "ButtonAction");
}

private DwsContextMenu? _rowMenu;

private static string RowMenuButtonId(ExampleDataElement item) => $"datagrid-demo-rowmenu-{item.ID}";

private List<DwsContextMenuItem> RowMenuItems =>
[
    new() { Text = "Edit content", Icon = Icons.BS.Pencil },
    new() { Text = "Edit general settings", Icon = Icons.BS.Gear },
    DwsContextMenuItem.Separator(),
    new() { Text = "Delete", Icon = Icons.BS.Trash, Color = DwsColor.Error },
];

// TargetData is the row's ID, handed over by ShowAtElementAsync.
private void RowMenuItemClick(DwsContextMenuItemClickEventArgs args) =>
    SnackbarNotification.ShowSnackbar($"{args.Item.Text}: #{args.TargetData}", DwsSnackbarLevel.Info, "RowMenu");

Maximum width and height combined

With both MaxWidth and MaxHeight set, the table scrolls horizontally and vertically.

Large Table
ActiveNameDescriptionDataType
dqlzfytzuzkcmdzdpppcrvtibureswajzgwbkhwivkyqxkpqkv6Standard
hiwdykhphyyacfhxththggwdkqeauwcoyhzoegilbgczrwhjim6.285714Complex
maltsiggvlwjcvgssmzhgaexmoiurhtrwtvzdloaeukrdhtmdq6.571429Standard
ylvngdzmoorfnjagphxzdlpnuevwqbodflvjdpelasfwzxtklx6.857143Complex
hmwitcidvnzoacnrcaclykgtowkkktbbkseimvwcdxxswkxrwu7.142857Standard
nxgduwrxsblyehxfehezibnnwdysopzbscegcjbzlfevgygqtr7.428571Complex
ymjsgrxyjdcjgbdrdufeodwrhywizwzlgherxjdkbnvbswsfnc7.714286Standard
vuprliupzmdrdyxlttrvdbhvzkfrvwiedpljbfyupmnixbtuib8Complex
nunusacduddznnmnjovwgrnyxxqljtnoarbrwhmxrmrkfynfiu8.285714Standard
fwhoxujrtaqpzwmvrccxeuzctzklcpbsptlfjhkrnasqupzrtn8.571428Complex
clxeuykypezxafkhljskjeciiezsspmlanqahenlgpknrxothm8.857142Standard
rxjpwqysgzsownpjzgwgdutpqlpgkfntntvsrsixnojlucabex9.142858Complex
dxeuylarhalybdrwsgyzspliuokncntswvpyowuwwvgiavbwkh9.428572Standard
zolwzjanpuhtbfoshvmbdwiciymoduinvzwbnsxkwigmbhuvir9.714286Complex
ucfiobxmjvltxcjnfpycfuqvbbergmuauzfuveevnjykbhjrlu10Standard
qzlkgmxfgxalzxwprakdovvfttrmflakqdjgilxryhdbjqhlvw10.285714Complex
budfqmvlzuwquwoqggctfhsuwdmfqjipkjbpccvkwmiietvlxf10.571428Standard
bucjjmapuqmhgluyndlrxsyjqchailtlheignttikgsswxnkry10.857142Complex
iiwssgfagiwazbcnlukchqzgmtpwjjuharvzkubmdjzkvwxlid11.142858Standard
hsjpgzriqxnpahgdcrsxzyqpkqvdogwxfrjcqvnbvvscwgwqfe11.428572Complex
jjcueqdntkaqjixdnhdrcefoseufyjfasbhaavqxyibhbgwnsc11.714286Standard
bedocawxpjfaxhaxcrrgsucxmlhhnvrmjfadwmtqbasscbipmu12Complex
uhcgbqspktrtqshxbpybfsbkvldsusvrkylsbqlcxlqzajkqho12.285714Standard
fcgrkqnauryaisgowlevdtccjmamkgzlpksjmjfvpxryaabsjt12.571428Complex
wmzdhypapnsnlxzxcnfjfgbdbjlhdrpqehogjjchfphdfnpesl12.857142Standard
bpkwbynhxyybidisotkydqzxyntgprakohgywnhetxrifdfmvz13.142858Complex
tlqmxoegsgyonaxkwbmgegyrsuihlptcqkouikpszneljrqepl13.428572Standard
znnztdfwudmvxdmcbmltgqbmhbeesamwrdkbhjqlndtbyoumrm13.714286Complex
gilasszbetrpetslusvzfdxaoshrmfrvlzxbphqymmyzkijatg14Standard
mcllmzkhozcwefvrvnbxmteypfigxfnaaamuqevrnfxzwoeefc14.285714Complex
ytymvgqekjmcvdtbaqskkhvebbaebvuildbswdjoaiunnusble14.571428Standard
mqxuktgmdopdqsbafxhejcmhqhjzsxtzvgqlvbsqhofgykdzzl14.857142Complex
vkdpddjhtgvpijbqederwvwgjgdkzhxpmnlghfypgauzkjbtxj15.142858Standard
mznxgwzzhmifdvxvjyepkvaxvzejmqabqpbmtjzbpgsiqfggwc15.428572Complex
lqypbgspnrmgonulczzczedsgqtxnkpskgekndisjatavkqtmk15.714286Standard
khmgilnubdbuviijyyqgszkcxwzaldkojvwwyhuwfpyqyboikd16Complex
vkwkjmlmiysmlallkrdtadbudvhrqhrifgzmaoyhltgzxmqowy16.285715Standard
bsjbgnfuwbhkheazlwsvihwbxresurovloehcyhkbqwfrnelox16.571428Complex
huwhepinaemlysaswmpiuskqjkntdwettjhkluusboqstgollw16.857143Standard
hpjfxtbpkdztrplphbrxgfcsxdvbhgvdnabsafxaqmdmsaoyav17.142857Complex
nbnqiuxaidiwfrnsobeqgucpawpxblswuemafkxcdqdzewuwkh17.428572Standard
ctzxqleayxllbbenneebnqqcldcsmtefbbbtaiulxcrgosusrx17.714285Complex
flcwlmimoetgkzalnfksdlzjotjjapzbxiwqrewhdlnmnihusg18Standard
ptmsirdzlzfribdjtiicprxmwgmoruekjitcdyveedaohwzfri18.285715Complex
zxwzwbfohquuiaiafvnexlrifahgwihdetivfecuyqwjumnzxq18.571428Standard
snfotwuzrzjqqornvbssghphosmhjgfqpcbvprkgzyyxadwyhj18.857143Complex
vkxyabjmqlttannvxdqmshjshkwnazkerugqxrrjwnimehdikl19.142857Standard
cobfqpewmraobghxyflgqfywoahncomstfrsosbbeaarlpfwbn19.428572Complex
vwperqirtyeivwooigejcqehkyuklpafmpjuckaktngcmdujhm19.714285Standard
cfshtsvyfexzwfmumyftqojbugekczkscpndcuqiouibfnhown20Complex
gnwqmmnlvguexgsjrrhwevghwhzqopzdqsizhmhdvdzbhbqavn20.285715Standard
fkgoufnxwggqoeysbfjebaweavryuatqejmxttrcpyhsvqmlcc20.571428Complex
Show Code
DataGrid.razor
@inject IDwsSnackbarNotificationService SnackbarNotification


<DwsDataGrid Name="DataGridDemo_BaseGridSizeBoth" T="ExampleDataElement" Items="@_elementsForExample2" Title="Large Table" MaxWidth="450" MaxHeight="500" PageSizeOptions="@_pageSizeOptionList" InitialPageSize="52">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeBoth_Column_ID" T="ExampleDataElement" Field="ID" Title="ID" Hidden="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeBoth_Column_Active" T="ExampleDataElement" Field="Active" Title="Active" Sortable="true" Alignment="DwsHorizontalAlignment.Center">
            <CellTemplate>
                <DwsIcon Name="@($"DataGridDemoBaseGridSizeBoth_Column_ActiveIcon_{context.Item.ID}")" Class="datagrid_i" Icon="@(context.Item.Active ? @Icons.BS.CheckLg: @Icons.BS.Circle)" Color="@(context.Item.Active ? DwsColor.Success: DwsColor.Text)" Size="DwsSize.Medium"></DwsIcon>
            </CellTemplate>
        </DwsDataGridColumn>
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeBoth_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" Sortable="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeBoth_Column_Descript" T="ExampleDataElement" Field="Description" Title="Description" Sortable="true" VisibilityBreakpoint="DwsVisibilityBreakpoint.XL" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeBoth_Column_Data" T="ExampleDataElement" Field="MyFloat" Title="Data" Sortable="true" Alignment="DwsHorizontalAlignment.Right" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeBoth_Column_Type" T="ExampleDataElement" Field="Type" Title="Type" Sortable="true" Alignment="DwsHorizontalAlignment.Center" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridSizeBoth_Column_Delete" T="ExampleDataElement">
            <CellTemplate>
                <DwsButton Name="@($"DataGridDemBaseGridSizeBoth_Delete_{context.Item.ID}")" Appearance="DwsAppearance.Icon" ButtonSize="DwsSize.Medium" Icon="@Icons.BS.Trash" Tooltip="Delete" OnClick="@(() => ButtonAction(@context.Item))" />
            </CellTemplate>
        </DwsDataGridColumn>
    </DwsDataGridColumns>
</DwsDataGrid>
DataGrid.razor.cs

private static readonly List<int> _pageSizeOptionList = new() { 23, 52, 101 };
private List<ExampleDataElement> _elementsForExample2 = ExampleDataElement.GenerateExampleList(330);

private void ButtonAction(ExampleDataElement item)
{
    SnackbarNotification.ShowSnackbar(item.Name, DwsSnackbarLevel.Info, "ButtonAction");
}

private DwsContextMenu? _rowMenu;

private static string RowMenuButtonId(ExampleDataElement item) => $"datagrid-demo-rowmenu-{item.ID}";

private List<DwsContextMenuItem> RowMenuItems =>
[
    new() { Text = "Edit content", Icon = Icons.BS.Pencil },
    new() { Text = "Edit general settings", Icon = Icons.BS.Gear },
    DwsContextMenuItem.Separator(),
    new() { Text = "Delete", Icon = Icons.BS.Trash, Color = DwsColor.Error },
];

// TargetData is the row's ID, handed over by ShowAtElementAsync.
private void RowMenuItemClick(DwsContextMenuItemClickEventArgs args) =>
    SnackbarNotification.ShowSnackbar($"{args.Item.Text}: #{args.TargetData}", DwsSnackbarLevel.Info, "RowMenu");

Minimum widths and long cell text

MinWidth sets the minimum width of a column in px. By default, text that is too long ends in an ellipsis and appears in full in a tooltip; in the Description column here, DisableTruncate wraps the text instead and DisableTooltip turns the tooltip off.

Column options
NameDescriptionType
tovmprfzvtglllcknghfwmwbyisyxprnoortcbhaechwabevkgStandard
ugrunhyhcfbswwtiimzhbtfaaxexoqnpejtkbhoabxabuiehbbComplex
dabrtpcbslsmoncigayzfetdfstwvmrxmdgtjkoyxaepjitresStandard
vyhxmawgfgtualgjywlzbfaeuxzbsdqtgihilmxobruxvpiikuComplex
cqydcpbvncpaordyylyxyklcifoqqxjrgogrjikimgdrhvbqfmStandard
trfvuxakeqtxtzkmoqbqkshtuneylebbrqvolnnnhbcnyjbbfsComplex
ebklbhsczzosgcdwaadoiipuvklcssgwuhluezmfufccygdyyjStandard
awlqqqvqkhtrxyqjraoxtdgnvphmeiajtchpjoiwjeuujgifhpComplex
ywpyubijlbgjyurbzdrrnpildogbepqjbodkalthnastoaioogStandard
rjodugvhewlxhjqgbojkdmwpxdfsnyzbjkwuwwrnlgwwiqszxhComplex
nfmygqadtgwjnxmwkexvyxqahhkgugsyvvwrhxqaninqzycumaStandard
pqpmrzftimnxnsavpnowiqkzaiequukrulfgcvfqutaacbkktrComplex
bzfplivpzocwdbmusthxboqjxzxtwdiafmkfankxvfulxfyixzStandard
fmjvslkbtvfbrqrhtfjkcwuemrapvwfqzqhxwevymulzgvohrqComplex
mjsfjakvfxqpcajukoklyhkvyrdtyfpmiiexervunqooirsnywStandard
teyxhrxrxaheguwlptspyhtvmhypubyxdlpazhkdwvtnhekyrnComplex
yllclasixwbjaufwmijotcofohwaxhtmykndowwkkoyxmydptvStandard
zvxgoddskqcpkqhbhqmzdeeqtpehgcguiolrgihsgsehvwnnhrComplex
gvrgnzzwlijhgwfqvzitslzwvwbrzonvhehpazvitkgwynprhrStandard
lvvulqxhwwuoacopqwdaziecyhhjjisytntmtgnellnjcjnndsComplex
udqsvdinyoevumibwkiypouvaoutgqgsnrtqwakkwxnzfhpaecStandard
mgivsgjphhhmhdtsevzxcrbvptztpdupzbenhbidbgqfrszlhmComplex
jvenfzhqzdmrmfzgldnvwvbvdwtoldguyfsjitwjwkhmszgtmaStandard
Show Code
DataGrid.razor

<DwsDataGrid Name="DataGridDemo_ColumnTextGrid" T="ExampleDataElement" Items="@_elementsForExample5" Title="Column options" PageSizeOptions="@_pageSizeOptionList" InitialPageSize="23">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoColumnTextGrid_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" MinWidth="220" />
        <DwsDataGridColumn Name="DataGridDemoColumnTextGrid_Column_Descript" T="ExampleDataElement" Field="Description" Title="Description" MinWidth="320" DisableTruncate="true" DisableTooltip="true" />
        <DwsDataGridColumn Name="DataGridDemoColumnTextGrid_Column_Type" T="ExampleDataElement" Field="Type" Title="Type" Alignment="DwsHorizontalAlignment.Center" />
    </DwsDataGridColumns>
</DwsDataGrid>
DataGrid.razor.cs

private static readonly List<int> _pageSizeOptionList = new() { 23, 52, 101 };
private List<ExampleDataElement> _elementsForExample5 = ExampleDataElement.GenerateExampleList(23);

Columns pinned to the edges

In this narrow grid, ID is pinned to the left edge and Type to the right edge, so both remain in view while the rest scrolls horizontally.

Pinned Columns
IDNameDescriptionDataType
1tovmprfzvtglllcknghfwmwbyisyxprnoortcbhaechwabevkg6Standard
2ugrunhyhcfbswwtiimzhbtfaaxexoqnpejtkbhoabxabuiehbb6.285714Complex
3dabrtpcbslsmoncigayzfetdfstwvmrxmdgtjkoyxaepjitres6.571429Standard
4vyhxmawgfgtualgjywlzbfaeuxzbsdqtgihilmxobruxvpiiku6.857143Complex
5cqydcpbvncpaordyylyxyklcifoqqxjrgogrjikimgdrhvbqfm7.142857Standard
6trfvuxakeqtxtzkmoqbqkshtuneylebbrqvolnnnhbcnyjbbfs7.428571Complex
7ebklbhsczzosgcdwaadoiipuvklcssgwuhluezmfufccygdyyj7.714286Standard
8awlqqqvqkhtrxyqjraoxtdgnvphmeiajtchpjoiwjeuujgifhp8Complex
9ywpyubijlbgjyurbzdrrnpildogbepqjbodkalthnastoaioog8.285714Standard
10rjodugvhewlxhjqgbojkdmwpxdfsnyzbjkwuwwrnlgwwiqszxh8.571428Complex
11nfmygqadtgwjnxmwkexvyxqahhkgugsyvvwrhxqaninqzycuma8.857142Standard
12pqpmrzftimnxnsavpnowiqkzaiequukrulfgcvfqutaacbkktr9.142858Complex
13bzfplivpzocwdbmusthxboqjxzxtwdiafmkfankxvfulxfyixz9.428572Standard
14fmjvslkbtvfbrqrhtfjkcwuemrapvwfqzqhxwevymulzgvohrq9.714286Complex
15mjsfjakvfxqpcajukoklyhkvyrdtyfpmiiexervunqooirsnyw10Standard
16teyxhrxrxaheguwlptspyhtvmhypubyxdlpazhkdwvtnhekyrn10.285714Complex
17yllclasixwbjaufwmijotcofohwaxhtmykndowwkkoyxmydptv10.571428Standard
18zvxgoddskqcpkqhbhqmzdeeqtpehgcguiolrgihsgsehvwnnhr10.857142Complex
19gvrgnzzwlijhgwfqvzitslzwvwbrzonvhehpazvitkgwynprhr11.142858Standard
20lvvulqxhwwuoacopqwdaziecyhhjjisytntmtgnellnjcjnnds11.428572Complex
21udqsvdinyoevumibwkiypouvaoutgqgsnrtqwakkwxnzfhpaec11.714286Standard
22mgivsgjphhhmhdtsevzxcrbvptztpdupzbenhbidbgqfrszlhm12Complex
23jvenfzhqzdmrmfzgldnvwvbvdwtoldguyfsjitwjwkhmszgtma12.285714Standard
Show Code
DataGrid.razor

<DwsDataGrid Name="DataGridDemo_PinnedColumnsGrid" T="ExampleDataElement" Items="@_elementsForExample5" Title="Pinned Columns" MaxWidth="500" PageSizeOptions="@_pageSizeOptionList" InitialPageSize="23">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoPinnedColumnsGrid_Column_ID" T="ExampleDataElement" Field="ID" Title="ID" MinWidth="80" Pin="DwsColumnPin.Left" />
        <DwsDataGridColumn Name="DataGridDemoPinnedColumnsGrid_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" MinWidth="200" />
        <DwsDataGridColumn Name="DataGridDemoPinnedColumnsGrid_Column_Descript" T="ExampleDataElement" Field="Description" Title="Description" MinWidth="300" />
        <DwsDataGridColumn Name="DataGridDemoPinnedColumnsGrid_Column_Data" T="ExampleDataElement" Field="MyFloat" Title="Data" MinWidth="150" Alignment="DwsHorizontalAlignment.Right" />
        <DwsDataGridColumn Name="DataGridDemoPinnedColumnsGrid_Column_Type" T="ExampleDataElement" Field="Type" Title="Type" MinWidth="120" Alignment="DwsHorizontalAlignment.Center" Pin="DwsColumnPin.Right" />
    </DwsDataGridColumns>
</DwsDataGrid>
DataGrid.razor.cs

private static readonly List<int> _pageSizeOptionList = new() { 23, 52, 101 };
private List<ExampleDataElement> _elementsForExample5 = ExampleDataElement.GenerateExampleList(23);

Footer totals per column

A column can show a summary in the footer: here the record count under Name, the sum of Data Int and the average of Data Float.

Column Summaries
NameData IntData Float
tovmprfzvt76
ugrunhyhcf76.285714
dabrtpcbsl76.571429
vyhxmawgfg86.857143
cqydcpbvnc87.142857
trfvuxakeq87.428571
ebklbhsczz97.714286
awlqqqvqkh98
ywpyubijlb98.285714
rjodugvhew108.571428
nfmygqadtg108.857142
pqpmrzftim109.142858
bzfplivpzo119.428572
fmjvslkbtv119.714286
mjsfjakvfx1110
teyxhrxrxa1210.285714
yllclasixw1210.571428
zvxgoddskq1210.857142
gvrgnzzwli1311.142858
lvvulqxhww1311.428572
udqsvdinyo1311.714286
mgivsgjphh1412
jvenfzhqzd1412.285714
232389.14
Show Code
DataGrid.razor

<DwsDataGrid Name="DataGridDemo_ColumnSummaryGrid" T="ExampleDataElement" Items="@_elementsForExample5" Title="Column Summaries" PageSizeOptions="@_pageSizeOptionList" InitialPageSize="23">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoColumnSummaryGrid_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" Summary="DwsColumnSummaryType.Count" />
        <DwsDataGridColumn Name="DataGridDemoColumnSummaryGrid_Column_Int" T="ExampleDataElement" Field="MyInt" Title="Data Int" Alignment="DwsHorizontalAlignment.Right" Summary="DwsColumnSummaryType.Sum" SummaryFormat="N0" />
        <DwsDataGridColumn Name="DataGridDemoColumnSummaryGrid_Column_Float" T="ExampleDataElement" Field="MyFloat" Title="Data Float" Alignment="DwsHorizontalAlignment.Right" Summary="DwsColumnSummaryType.Average" />
    </DwsDataGridColumns>
</DwsDataGrid>
DataGrid.razor.cs

private static readonly List<int> _pageSizeOptionList = new() { 23, 52, 101 };
private List<ExampleDataElement> _elementsForExample5 = ExampleDataElement.GenerateExampleList(23);

Marking rows with a CSS class

The rows listed by index in HighlightedRowsIndex receive the CSS class named in HighlightedRowsClass, cross_row in this example.

Large Table
ActiveNameDescriptionDataType
dqlzfytzuzkcmdzdpppcrvtibureswajzgwbkhwivkyqxkpqkv6Standard
hiwdykhphyyacfhxththggwdkqeauwcoyhzoegilbgczrwhjim6.285714Complex
maltsiggvlwjcvgssmzhgaexmoiurhtrwtvzdloaeukrdhtmdq6.571429Standard
ylvngdzmoorfnjagphxzdlpnuevwqbodflvjdpelasfwzxtklx6.857143Complex
hmwitcidvnzoacnrcaclykgtowkkktbbkseimvwcdxxswkxrwu7.142857Standard
nxgduwrxsblyehxfehezibnnwdysopzbscegcjbzlfevgygqtr7.428571Complex
ymjsgrxyjdcjgbdrdufeodwrhywizwzlgherxjdkbnvbswsfnc7.714286Standard
vuprliupzmdrdyxlttrvdbhvzkfrvwiedpljbfyupmnixbtuib8Complex
nunusacduddznnmnjovwgrnyxxqljtnoarbrwhmxrmrkfynfiu8.285714Standard
fwhoxujrtaqpzwmvrccxeuzctzklcpbsptlfjhkrnasqupzrtn8.571428Complex
clxeuykypezxafkhljskjeciiezsspmlanqahenlgpknrxothm8.857142Standard
rxjpwqysgzsownpjzgwgdutpqlpgkfntntvsrsixnojlucabex9.142858Complex
dxeuylarhalybdrwsgyzspliuokncntswvpyowuwwvgiavbwkh9.428572Standard
zolwzjanpuhtbfoshvmbdwiciymoduinvzwbnsxkwigmbhuvir9.714286Complex
ucfiobxmjvltxcjnfpycfuqvbbergmuauzfuveevnjykbhjrlu10Standard
qzlkgmxfgxalzxwprakdovvfttrmflakqdjgilxryhdbjqhlvw10.285714Complex
budfqmvlzuwquwoqggctfhsuwdmfqjipkjbpccvkwmiietvlxf10.571428Standard
bucjjmapuqmhgluyndlrxsyjqchailtlheignttikgsswxnkry10.857142Complex
iiwssgfagiwazbcnlukchqzgmtpwjjuharvzkubmdjzkvwxlid11.142858Standard
hsjpgzriqxnpahgdcrsxzyqpkqvdogwxfrjcqvnbvvscwgwqfe11.428572Complex
jjcueqdntkaqjixdnhdrcefoseufyjfasbhaavqxyibhbgwnsc11.714286Standard
bedocawxpjfaxhaxcrrgsucxmlhhnvrmjfadwmtqbasscbipmu12Complex
uhcgbqspktrtqshxbpybfsbkvldsusvrkylsbqlcxlqzajkqho12.285714Standard
fcgrkqnauryaisgowlevdtccjmamkgzlpksjmjfvpxryaabsjt12.571428Complex
wmzdhypapnsnlxzxcnfjfgbdbjlhdrpqehogjjchfphdfnpesl12.857142Standard
bpkwbynhxyybidisotkydqzxyntgprakohgywnhetxrifdfmvz13.142858Complex
tlqmxoegsgyonaxkwbmgegyrsuihlptcqkouikpszneljrqepl13.428572Standard
znnztdfwudmvxdmcbmltgqbmhbeesamwrdkbhjqlndtbyoumrm13.714286Complex
gilasszbetrpetslusvzfdxaoshrmfrvlzxbphqymmyzkijatg14Standard
mcllmzkhozcwefvrvnbxmteypfigxfnaaamuqevrnfxzwoeefc14.285714Complex
ytymvgqekjmcvdtbaqskkhvebbaebvuildbswdjoaiunnusble14.571428Standard
mqxuktgmdopdqsbafxhejcmhqhjzsxtzvgqlvbsqhofgykdzzl14.857142Complex
vkdpddjhtgvpijbqederwvwgjgdkzhxpmnlghfypgauzkjbtxj15.142858Standard
mznxgwzzhmifdvxvjyepkvaxvzejmqabqpbmtjzbpgsiqfggwc15.428572Complex
lqypbgspnrmgonulczzczedsgqtxnkpskgekndisjatavkqtmk15.714286Standard
khmgilnubdbuviijyyqgszkcxwzaldkojvwwyhuwfpyqyboikd16Complex
vkwkjmlmiysmlallkrdtadbudvhrqhrifgzmaoyhltgzxmqowy16.285715Standard
bsjbgnfuwbhkheazlwsvihwbxresurovloehcyhkbqwfrnelox16.571428Complex
huwhepinaemlysaswmpiuskqjkntdwettjhkluusboqstgollw16.857143Standard
hpjfxtbpkdztrplphbrxgfcsxdvbhgvdnabsafxaqmdmsaoyav17.142857Complex
nbnqiuxaidiwfrnsobeqgucpawpxblswuemafkxcdqdzewuwkh17.428572Standard
ctzxqleayxllbbenneebnqqcldcsmtefbbbtaiulxcrgosusrx17.714285Complex
flcwlmimoetgkzalnfksdlzjotjjapzbxiwqrewhdlnmnihusg18Standard
ptmsirdzlzfribdjtiicprxmwgmoruekjitcdyveedaohwzfri18.285715Complex
zxwzwbfohquuiaiafvnexlrifahgwihdetivfecuyqwjumnzxq18.571428Standard
snfotwuzrzjqqornvbssghphosmhjgfqpcbvprkgzyyxadwyhj18.857143Complex
vkxyabjmqlttannvxdqmshjshkwnazkerugqxrrjwnimehdikl19.142857Standard
cobfqpewmraobghxyflgqfywoahncomstfrsosbbeaarlpfwbn19.428572Complex
vwperqirtyeivwooigejcqehkyuklpafmpjuckaktngcmdujhm19.714285Standard
cfshtsvyfexzwfmumyftqojbugekczkscpndcuqiouibfnhown20Complex
gnwqmmnlvguexgsjrrhwevghwhzqopzdqsizhmhdvdzbhbqavn20.285715Standard
fkgoufnxwggqoeysbfjebaweavryuatqejmxttrcpyhsvqmlcc20.571428Complex
Show Code
DataGrid.razor
@inject IDwsSnackbarNotificationService SnackbarNotification


<DwsDataGrid Name="DataGridDemo_BaseGridHightlightRow" T="ExampleDataElement" Items="@_elementsForExample2" Title="Large Table" PageSizeOptions="@_pageSizeOptionList" InitialPageSize="52" HighlightedRowsClass="cross_row" HighlightedRowsIndex="new List<int>{1,5,2,3,4,29}">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow_Column_ID" T="ExampleDataElement" Field="ID" Title="ID" Hidden="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow_Column_Active" T="ExampleDataElement" Field="Active" Title="Active" Sortable="true" Alignment="DwsHorizontalAlignment.Center">
            <CellTemplate>
                <DwsIcon Name="@($"DataGridDemoBaseGridHightlightRow_Column_ActiveIcon_{context.Item.ID}")" Class="datagrid_i" Icon="@(context.Item.Active ? @Icons.BS.CheckLg: @Icons.BS.Circle)" Color="@(context.Item.Active ? DwsColor.Success: DwsColor.Text)" Size="DwsSize.Medium"></DwsIcon>
            </CellTemplate>
        </DwsDataGridColumn>
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" Sortable="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow_Column_Descript" T="ExampleDataElement" Field="Description" Title="Description" Sortable="true" VisibilityBreakpoint="DwsVisibilityBreakpoint.XL" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow_Column_Data" T="ExampleDataElement" Field="MyFloat" Title="Data" Sortable="true" Alignment="DwsHorizontalAlignment.Right" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow_Column_Type" T="ExampleDataElement" Field="Type" Title="Type" Sortable="true" Alignment="DwsHorizontalAlignment.Center" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow_Column_Delete" T="ExampleDataElement">
            <CellTemplate>
                <DwsButton Name="@($"DataGridDemBaseGridHightlightRow_Delete_{context.Item.ID}")" Appearance="DwsAppearance.Icon" ButtonSize="DwsSize.Medium" Icon="@Icons.BS.Trash" Tooltip="Delete" OnClick="@(() => ButtonAction(@context.Item))" />
            </CellTemplate>
        </DwsDataGridColumn>
    </DwsDataGridColumns>
</DwsDataGrid>
DataGrid.razor.cs

private static readonly List<int> _pageSizeOptionList = new() { 23, 52, 101 };
private List<ExampleDataElement> _elementsForExample2 = ExampleDataElement.GenerateExampleList(330);

private void ButtonAction(ExampleDataElement item)
{
    SnackbarNotification.ShowSnackbar(item.Name, DwsSnackbarLevel.Info, "ButtonAction");
}

private DwsContextMenu? _rowMenu;

private static string RowMenuButtonId(ExampleDataElement item) => $"datagrid-demo-rowmenu-{item.ID}";

private List<DwsContextMenuItem> RowMenuItems =>
[
    new() { Text = "Edit content", Icon = Icons.BS.Pencil },
    new() { Text = "Edit general settings", Icon = Icons.BS.Gear },
    DwsContextMenuItem.Separator(),
    new() { Text = "Delete", Icon = Icons.BS.Trash, Color = DwsColor.Error },
];

// TargetData is the row's ID, handed over by ShowAtElementAsync.
private void RowMenuItemClick(DwsContextMenuItemClickEventArgs args) =>
    SnackbarNotification.ShowSnackbar($"{args.Item.Text}: #{args.TargetData}", DwsSnackbarLevel.Info, "RowMenu");

Marking rows with the warning class

The same row indexes, this time with the class cross_row_warning.

Large Table
ActiveNameDescriptionDataType
dqlzfytzuzkcmdzdpppcrvtibureswajzgwbkhwivkyqxkpqkv6Standard
hiwdykhphyyacfhxththggwdkqeauwcoyhzoegilbgczrwhjim6.285714Complex
maltsiggvlwjcvgssmzhgaexmoiurhtrwtvzdloaeukrdhtmdq6.571429Standard
ylvngdzmoorfnjagphxzdlpnuevwqbodflvjdpelasfwzxtklx6.857143Complex
hmwitcidvnzoacnrcaclykgtowkkktbbkseimvwcdxxswkxrwu7.142857Standard
nxgduwrxsblyehxfehezibnnwdysopzbscegcjbzlfevgygqtr7.428571Complex
ymjsgrxyjdcjgbdrdufeodwrhywizwzlgherxjdkbnvbswsfnc7.714286Standard
vuprliupzmdrdyxlttrvdbhvzkfrvwiedpljbfyupmnixbtuib8Complex
nunusacduddznnmnjovwgrnyxxqljtnoarbrwhmxrmrkfynfiu8.285714Standard
fwhoxujrtaqpzwmvrccxeuzctzklcpbsptlfjhkrnasqupzrtn8.571428Complex
clxeuykypezxafkhljskjeciiezsspmlanqahenlgpknrxothm8.857142Standard
rxjpwqysgzsownpjzgwgdutpqlpgkfntntvsrsixnojlucabex9.142858Complex
dxeuylarhalybdrwsgyzspliuokncntswvpyowuwwvgiavbwkh9.428572Standard
zolwzjanpuhtbfoshvmbdwiciymoduinvzwbnsxkwigmbhuvir9.714286Complex
ucfiobxmjvltxcjnfpycfuqvbbergmuauzfuveevnjykbhjrlu10Standard
qzlkgmxfgxalzxwprakdovvfttrmflakqdjgilxryhdbjqhlvw10.285714Complex
budfqmvlzuwquwoqggctfhsuwdmfqjipkjbpccvkwmiietvlxf10.571428Standard
bucjjmapuqmhgluyndlrxsyjqchailtlheignttikgsswxnkry10.857142Complex
iiwssgfagiwazbcnlukchqzgmtpwjjuharvzkubmdjzkvwxlid11.142858Standard
hsjpgzriqxnpahgdcrsxzyqpkqvdogwxfrjcqvnbvvscwgwqfe11.428572Complex
jjcueqdntkaqjixdnhdrcefoseufyjfasbhaavqxyibhbgwnsc11.714286Standard
bedocawxpjfaxhaxcrrgsucxmlhhnvrmjfadwmtqbasscbipmu12Complex
uhcgbqspktrtqshxbpybfsbkvldsusvrkylsbqlcxlqzajkqho12.285714Standard
fcgrkqnauryaisgowlevdtccjmamkgzlpksjmjfvpxryaabsjt12.571428Complex
wmzdhypapnsnlxzxcnfjfgbdbjlhdrpqehogjjchfphdfnpesl12.857142Standard
bpkwbynhxyybidisotkydqzxyntgprakohgywnhetxrifdfmvz13.142858Complex
tlqmxoegsgyonaxkwbmgegyrsuihlptcqkouikpszneljrqepl13.428572Standard
znnztdfwudmvxdmcbmltgqbmhbeesamwrdkbhjqlndtbyoumrm13.714286Complex
gilasszbetrpetslusvzfdxaoshrmfrvlzxbphqymmyzkijatg14Standard
mcllmzkhozcwefvrvnbxmteypfigxfnaaamuqevrnfxzwoeefc14.285714Complex
ytymvgqekjmcvdtbaqskkhvebbaebvuildbswdjoaiunnusble14.571428Standard
mqxuktgmdopdqsbafxhejcmhqhjzsxtzvgqlvbsqhofgykdzzl14.857142Complex
vkdpddjhtgvpijbqederwvwgjgdkzhxpmnlghfypgauzkjbtxj15.142858Standard
mznxgwzzhmifdvxvjyepkvaxvzejmqabqpbmtjzbpgsiqfggwc15.428572Complex
lqypbgspnrmgonulczzczedsgqtxnkpskgekndisjatavkqtmk15.714286Standard
khmgilnubdbuviijyyqgszkcxwzaldkojvwwyhuwfpyqyboikd16Complex
vkwkjmlmiysmlallkrdtadbudvhrqhrifgzmaoyhltgzxmqowy16.285715Standard
bsjbgnfuwbhkheazlwsvihwbxresurovloehcyhkbqwfrnelox16.571428Complex
huwhepinaemlysaswmpiuskqjkntdwettjhkluusboqstgollw16.857143Standard
hpjfxtbpkdztrplphbrxgfcsxdvbhgvdnabsafxaqmdmsaoyav17.142857Complex
nbnqiuxaidiwfrnsobeqgucpawpxblswuemafkxcdqdzewuwkh17.428572Standard
ctzxqleayxllbbenneebnqqcldcsmtefbbbtaiulxcrgosusrx17.714285Complex
flcwlmimoetgkzalnfksdlzjotjjapzbxiwqrewhdlnmnihusg18Standard
ptmsirdzlzfribdjtiicprxmwgmoruekjitcdyveedaohwzfri18.285715Complex
zxwzwbfohquuiaiafvnexlrifahgwihdetivfecuyqwjumnzxq18.571428Standard
snfotwuzrzjqqornvbssghphosmhjgfqpcbvprkgzyyxadwyhj18.857143Complex
vkxyabjmqlttannvxdqmshjshkwnazkerugqxrrjwnimehdikl19.142857Standard
cobfqpewmraobghxyflgqfywoahncomstfrsosbbeaarlpfwbn19.428572Complex
vwperqirtyeivwooigejcqehkyuklpafmpjuckaktngcmdujhm19.714285Standard
cfshtsvyfexzwfmumyftqojbugekczkscpndcuqiouibfnhown20Complex
gnwqmmnlvguexgsjrrhwevghwhzqopzdqsizhmhdvdzbhbqavn20.285715Standard
fkgoufnxwggqoeysbfjebaweavryuatqejmxttrcpyhsvqmlcc20.571428Complex
Show Code
DataGrid.razor
@inject IDwsSnackbarNotificationService SnackbarNotification


<DwsDataGrid Name="DataGridDemo_BaseGridHightlightRow2" T="ExampleDataElement" Items="@_elementsForExample2" Title="Large Table" PageSizeOptions="@_pageSizeOptionList" InitialPageSize="52" HighlightedRowsClass="cross_row_warning" HighlightedRowsIndex="new List<int>{1,5,2,3,4,29}">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow2_Column_ID" T="ExampleDataElement" Field="ID" Title="ID" Hidden="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow2_Column_Active" T="ExampleDataElement" Field="Active" Title="Active" Sortable="true" Alignment="DwsHorizontalAlignment.Center">
            <CellTemplate>
                <DwsIcon Name="@($"DataGridDemoBaseGridHightlightRow2_Column_ActiveIcon_{context.Item.ID}")" Class="datagrid_i" Icon="@(context.Item.Active ? @Icons.BS.CheckLg: @Icons.BS.Circle)" Color="@(context.Item.Active ? DwsColor.Success: DwsColor.Text)" Size="DwsSize.Medium"></DwsIcon>
            </CellTemplate>
        </DwsDataGridColumn>
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow2_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" Sortable="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow2_Column_Descript" T="ExampleDataElement" Field="Description" Title="Description" Sortable="true" VisibilityBreakpoint="DwsVisibilityBreakpoint.XL" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow2_Column_Data" T="ExampleDataElement" Field="MyFloat" Title="Data" Sortable="true" Alignment="DwsHorizontalAlignment.Right" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow2_Column_Type" T="ExampleDataElement" Field="Type" Title="Type" Sortable="true" Alignment="DwsHorizontalAlignment.Center" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow2_Column_Delete" T="ExampleDataElement">
            <CellTemplate>
                <DwsButton Name="@($"DataGridDemBaseGridHightlightRow2_Delete_{context.Item.ID}")" Appearance="DwsAppearance.Icon" ButtonSize="DwsSize.Medium" Icon="@Icons.BS.Trash" Tooltip="Delete" OnClick="@(() => ButtonAction(@context.Item))" />
            </CellTemplate>
        </DwsDataGridColumn>
    </DwsDataGridColumns>
</DwsDataGrid>
DataGrid.razor.cs

private static readonly List<int> _pageSizeOptionList = new() { 23, 52, 101 };
private List<ExampleDataElement> _elementsForExample2 = ExampleDataElement.GenerateExampleList(330);

private void ButtonAction(ExampleDataElement item)
{
    SnackbarNotification.ShowSnackbar(item.Name, DwsSnackbarLevel.Info, "ButtonAction");
}

private DwsContextMenu? _rowMenu;

private static string RowMenuButtonId(ExampleDataElement item) => $"datagrid-demo-rowmenu-{item.ID}";

private List<DwsContextMenuItem> RowMenuItems =>
[
    new() { Text = "Edit content", Icon = Icons.BS.Pencil },
    new() { Text = "Edit general settings", Icon = Icons.BS.Gear },
    DwsContextMenuItem.Separator(),
    new() { Text = "Delete", Icon = Icons.BS.Trash, Color = DwsColor.Error },
];

// TargetData is the row's ID, handed over by ShowAtElementAsync.
private void RowMenuItemClick(DwsContextMenuItemClickEventArgs args) =>
    SnackbarNotification.ShowSnackbar($"{args.Item.Text}: #{args.TargetData}", DwsSnackbarLevel.Info, "RowMenu");

Marking rows with an inline style

Instead of a class, HighlightedRowsStyle applies inline CSS to the highlighted rows - in this case struck-through text on a warning background.

Large Table
ActiveNameDescriptionDataType
dqlzfytzuzkcmdzdpppcrvtibureswajzgwbkhwivkyqxkpqkv6Standard
hiwdykhphyyacfhxththggwdkqeauwcoyhzoegilbgczrwhjim6.285714Complex
maltsiggvlwjcvgssmzhgaexmoiurhtrwtvzdloaeukrdhtmdq6.571429Standard
ylvngdzmoorfnjagphxzdlpnuevwqbodflvjdpelasfwzxtklx6.857143Complex
hmwitcidvnzoacnrcaclykgtowkkktbbkseimvwcdxxswkxrwu7.142857Standard
nxgduwrxsblyehxfehezibnnwdysopzbscegcjbzlfevgygqtr7.428571Complex
ymjsgrxyjdcjgbdrdufeodwrhywizwzlgherxjdkbnvbswsfnc7.714286Standard
vuprliupzmdrdyxlttrvdbhvzkfrvwiedpljbfyupmnixbtuib8Complex
nunusacduddznnmnjovwgrnyxxqljtnoarbrwhmxrmrkfynfiu8.285714Standard
fwhoxujrtaqpzwmvrccxeuzctzklcpbsptlfjhkrnasqupzrtn8.571428Complex
clxeuykypezxafkhljskjeciiezsspmlanqahenlgpknrxothm8.857142Standard
rxjpwqysgzsownpjzgwgdutpqlpgkfntntvsrsixnojlucabex9.142858Complex
dxeuylarhalybdrwsgyzspliuokncntswvpyowuwwvgiavbwkh9.428572Standard
zolwzjanpuhtbfoshvmbdwiciymoduinvzwbnsxkwigmbhuvir9.714286Complex
ucfiobxmjvltxcjnfpycfuqvbbergmuauzfuveevnjykbhjrlu10Standard
qzlkgmxfgxalzxwprakdovvfttrmflakqdjgilxryhdbjqhlvw10.285714Complex
budfqmvlzuwquwoqggctfhsuwdmfqjipkjbpccvkwmiietvlxf10.571428Standard
bucjjmapuqmhgluyndlrxsyjqchailtlheignttikgsswxnkry10.857142Complex
iiwssgfagiwazbcnlukchqzgmtpwjjuharvzkubmdjzkvwxlid11.142858Standard
hsjpgzriqxnpahgdcrsxzyqpkqvdogwxfrjcqvnbvvscwgwqfe11.428572Complex
jjcueqdntkaqjixdnhdrcefoseufyjfasbhaavqxyibhbgwnsc11.714286Standard
bedocawxpjfaxhaxcrrgsucxmlhhnvrmjfadwmtqbasscbipmu12Complex
uhcgbqspktrtqshxbpybfsbkvldsusvrkylsbqlcxlqzajkqho12.285714Standard
fcgrkqnauryaisgowlevdtccjmamkgzlpksjmjfvpxryaabsjt12.571428Complex
wmzdhypapnsnlxzxcnfjfgbdbjlhdrpqehogjjchfphdfnpesl12.857142Standard
bpkwbynhxyybidisotkydqzxyntgprakohgywnhetxrifdfmvz13.142858Complex
tlqmxoegsgyonaxkwbmgegyrsuihlptcqkouikpszneljrqepl13.428572Standard
znnztdfwudmvxdmcbmltgqbmhbeesamwrdkbhjqlndtbyoumrm13.714286Complex
gilasszbetrpetslusvzfdxaoshrmfrvlzxbphqymmyzkijatg14Standard
mcllmzkhozcwefvrvnbxmteypfigxfnaaamuqevrnfxzwoeefc14.285714Complex
ytymvgqekjmcvdtbaqskkhvebbaebvuildbswdjoaiunnusble14.571428Standard
mqxuktgmdopdqsbafxhejcmhqhjzsxtzvgqlvbsqhofgykdzzl14.857142Complex
vkdpddjhtgvpijbqederwvwgjgdkzhxpmnlghfypgauzkjbtxj15.142858Standard
mznxgwzzhmifdvxvjyepkvaxvzejmqabqpbmtjzbpgsiqfggwc15.428572Complex
lqypbgspnrmgonulczzczedsgqtxnkpskgekndisjatavkqtmk15.714286Standard
khmgilnubdbuviijyyqgszkcxwzaldkojvwwyhuwfpyqyboikd16Complex
vkwkjmlmiysmlallkrdtadbudvhrqhrifgzmaoyhltgzxmqowy16.285715Standard
bsjbgnfuwbhkheazlwsvihwbxresurovloehcyhkbqwfrnelox16.571428Complex
huwhepinaemlysaswmpiuskqjkntdwettjhkluusboqstgollw16.857143Standard
hpjfxtbpkdztrplphbrxgfcsxdvbhgvdnabsafxaqmdmsaoyav17.142857Complex
nbnqiuxaidiwfrnsobeqgucpawpxblswuemafkxcdqdzewuwkh17.428572Standard
ctzxqleayxllbbenneebnqqcldcsmtefbbbtaiulxcrgosusrx17.714285Complex
flcwlmimoetgkzalnfksdlzjotjjapzbxiwqrewhdlnmnihusg18Standard
ptmsirdzlzfribdjtiicprxmwgmoruekjitcdyveedaohwzfri18.285715Complex
zxwzwbfohquuiaiafvnexlrifahgwihdetivfecuyqwjumnzxq18.571428Standard
snfotwuzrzjqqornvbssghphosmhjgfqpcbvprkgzyyxadwyhj18.857143Complex
vkxyabjmqlttannvxdqmshjshkwnazkerugqxrrjwnimehdikl19.142857Standard
cobfqpewmraobghxyflgqfywoahncomstfrsosbbeaarlpfwbn19.428572Complex
vwperqirtyeivwooigejcqehkyuklpafmpjuckaktngcmdujhm19.714285Standard
cfshtsvyfexzwfmumyftqojbugekczkscpndcuqiouibfnhown20Complex
gnwqmmnlvguexgsjrrhwevghwhzqopzdqsizhmhdvdzbhbqavn20.285715Standard
fkgoufnxwggqoeysbfjebaweavryuatqejmxttrcpyhsvqmlcc20.571428Complex
Show Code
DataGrid.razor
@inject IDwsSnackbarNotificationService SnackbarNotification


<DwsDataGrid Name="DataGridDemo_BaseGridHightlightRow3" T="ExampleDataElement" Items="@_elementsForExample2" Title="Large Table" PageSizeOptions="@_pageSizeOptionList" InitialPageSize="52" HighlightedRowsStyle="text-decoration-line: line-through; background-color: var(--warning) !important; color: var(--status-text) !important;" HighlightedRowsIndex="new List<int>{1,5,2,3,4,29}">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow3_Column_ID" T="ExampleDataElement" Field="ID" Title="ID" Hidden="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow3_Column_Active" T="ExampleDataElement" Field="Active" Title="Active" Sortable="true" Alignment="DwsHorizontalAlignment.Center">
            <CellTemplate>
                <DwsIcon Name="@($"DataGridDemoBaseGridHightlightRow3_Column_ActiveIcon_{context.Item.ID}")" Class="datagrid_i" Icon="@(context.Item.Active ? @Icons.BS.CheckLg: @Icons.BS.Circle)" Color="@(context.Item.Active ? DwsColor.Success: DwsColor.Text)" Size="DwsSize.Medium"></DwsIcon>
            </CellTemplate>
        </DwsDataGridColumn>
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow3_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" Sortable="true" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow3_Column_Descript" T="ExampleDataElement" Field="Description" Title="Description" Sortable="true" VisibilityBreakpoint="DwsVisibilityBreakpoint.XL" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow3_Column_Data" T="ExampleDataElement" Field="MyFloat" Title="Data" Sortable="true" Alignment="DwsHorizontalAlignment.Right" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow3_Column_Type" T="ExampleDataElement" Field="Type" Title="Type" Sortable="true" Alignment="DwsHorizontalAlignment.Center" />
        <DwsDataGridColumn Name="DataGridDemoBaseGridHightlightRow3_Column_Delete" T="ExampleDataElement">
            <CellTemplate>
                <DwsButton Name="@($"DataGridDemBaseGridHightlightRow3_Delete_{context.Item.ID}")" Appearance="DwsAppearance.Icon" ButtonSize="DwsSize.Medium" Icon="@Icons.BS.Trash" Tooltip="Delete" OnClick="@(() => ButtonAction(@context.Item))" />
            </CellTemplate>
        </DwsDataGridColumn>
    </DwsDataGridColumns>
</DwsDataGrid>
DataGrid.razor.cs

private static readonly List<int> _pageSizeOptionList = new() { 23, 52, 101 };
private List<ExampleDataElement> _elementsForExample2 = ExampleDataElement.GenerateExampleList(330);

private void ButtonAction(ExampleDataElement item)
{
    SnackbarNotification.ShowSnackbar(item.Name, DwsSnackbarLevel.Info, "ButtonAction");
}

private DwsContextMenu? _rowMenu;

private static string RowMenuButtonId(ExampleDataElement item) => $"datagrid-demo-rowmenu-{item.ID}";

private List<DwsContextMenuItem> RowMenuItems =>
[
    new() { Text = "Edit content", Icon = Icons.BS.Pencil },
    new() { Text = "Edit general settings", Icon = Icons.BS.Gear },
    DwsContextMenuItem.Separator(),
    new() { Text = "Delete", Icon = Icons.BS.Trash, Color = DwsColor.Error },
];

// TargetData is the row's ID, handed over by ShowAtElementAsync.
private void RowMenuItemClick(DwsContextMenuItemClickEventArgs args) =>
    SnackbarNotification.ShowSnackbar($"{args.Item.Text}: #{args.TargetData}", DwsSnackbarLevel.Info, "RowMenu");

Row style and tooltip per record

RowClass picks a CSS class for each record, so rows can be coloured by their data, and RowTooltip gives every row a tooltip of its own.

Row Formatting
NameActiveType
tovmprfzvtTrueStandard
ugrunhyhcfTrueComplex
dabrtpcbslFalseStandard
vyhxmawgfgTrueComplex
cqydcpbvncTrueStandard
trfvuxakeqFalseComplex
ebklbhsczzTrueStandard
awlqqqvqkhTrueComplex
ywpyubijlbFalseStandard
rjodugvhewTrueComplex
nfmygqadtgTrueStandard
pqpmrzftimFalseComplex
bzfplivpzoTrueStandard
fmjvslkbtvTrueComplex
mjsfjakvfxFalseStandard
teyxhrxrxaTrueComplex
yllclasixwTrueStandard
zvxgoddskqFalseComplex
gvrgnzzwliTrueStandard
lvvulqxhwwTrueComplex
udqsvdinyoFalseStandard
mgivsgjphhTrueComplex
jvenfzhqzdTrueStandard
Show Code
DataGrid.razor

<DwsDataGrid Name="DataGridDemo_RowFormattingGrid" T="ExampleDataElement" Items="@_elementsForExample5" Title="Row Formatting" RowClass="@RowClassForElement" RowTooltip="@(item => $"Type: {(item.Type)}, Active: {(item.Active)}")" PageSizeOptions="@_pageSizeOptionList" InitialPageSize="23">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoRowFormattingGrid_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" />
        <DwsDataGridColumn Name="DataGridDemoRowFormattingGrid_Column_Active" T="ExampleDataElement" Field="Active" Title="Active" Alignment="DwsHorizontalAlignment.Center" />
        <DwsDataGridColumn Name="DataGridDemoRowFormattingGrid_Column_Type" T="ExampleDataElement" Field="Type" Title="Type" Alignment="DwsHorizontalAlignment.Center" />
    </DwsDataGridColumns>
</DwsDataGrid>
DataGrid.razor.cs

private static readonly List<int> _pageSizeOptionList = new() { 23, 52, 101 };
private List<ExampleDataElement> _elementsForExample5 = ExampleDataElement.GenerateExampleList(23);

private string RowClassForElement(ExampleDataElement item) =>
    item.Active ? string.Empty : "cross_row_warning";

Expandable row details

Given a RowDetailTemplate, the grid adds an expand column, and the details open underneath their row.

Table Name
NameDataType
yttsshklfy6Standard
Description of yttsshklfy:

rhnrzhbfyedhrnrynwidwcigdfifbqemvkeptpdo

fqbgattndc6.285714Complex
Description of fqbgattndc:

coygnuzwdiaqlhjcfxttoqfubmdcehwritipqmbi

noeuxyowtj6.571429Standard
Description of noeuxyowtj:

nljefbrwrwlihsytltvkewoqhmhifgtayygxgmga

dfgmvdnuai6.857143Complex
Description of dfgmvdnuai:

frwtxstirlckkjlbnynvtmvimcgvmbtyaptpampn

dsuxauqohe7.142857Standard
Description of dsuxauqohe:

psvngvmyvqrdkupwaajzokmgeuhjuskfrvabumgu

xzhahetqei7.428571Complex
Description of xzhahetqei:

qegojmocecfmmptocnupyfwcjemgbqzuajevugdt

eknshtbfwp7.714286Standard
Description of eknshtbfwp:

jkieeezhbodlmdkxtwjaiablxzrtyhotykztnqbz

hsyjikafvv8Complex
Description of hsyjikafvv:

gjjwgfmfjtzknbeqjdukgkclefbilohjxcdqkqjw

qwfwfrawkl8.285714Standard
Description of qwfwfrawkl:

pwgxsbeduvlqmlyoftuywrvyvhzectnkymmhjnyh

szkuyrlhcm8.571428Complex
Description of szkuyrlhcm:

pxahbkbzbahasayqesvmfmxbgwxfglhgilwphbln

Show Code
DataGrid.razor

<DwsDataGrid Name="DataGridDemo_GridWithDetailView" T="ExampleDataElement" Items="@_elementsForExample1" Title="Table Name">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoGridWithDetailView_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" Sortable="true" />
        <DwsDataGridColumn Name="DataGridDemoGridWithDetailView_Column_Data" T="ExampleDataElement" Field="MyFloat" Title="Data" Sortable="true" Alignment="DwsHorizontalAlignment.Right" />
        <DwsDataGridColumn Name="DataGridDemoGridWithDetailView_Column_Type" T="ExampleDataElement" Field="Type" Title="Type" Sortable="true" Alignment="DwsHorizontalAlignment.Center" />
    </DwsDataGridColumns>
    <RowDetailTemplate>
        <DwsPaper Name="DataGridDemoGridWithDetailView_DetailViewPaper" Style="padding:6px;">
            <span>Description of @(context.Item.Name):</span>
            <p>@context.Item.Description</p>
        </DwsPaper>
    </RowDetailTemplate>
</DwsDataGrid>
DataGrid.razor.cs

private List<ExampleDataElement> _elementsForExample1 = ExampleDataElement.GenerateExampleList(10);

Grouping rows by a field

GroupByField splits the rows by the given field into collapsible sections, each headed by a row with the key and the count. Since the group key is the first sort key, the rows of a group stay together across all pages; if the pager cuts a group, the group shows the rows on this page out of the total. Every expand and collapse is reported through OnGroupToggled.

Grouping
NameType
Complex 11
ugrunhyhcfComplex
vyhxmawgfgComplex
trfvuxakeqComplex
awlqqqvqkhComplex
rjodugvhewComplex
pqpmrzftimComplex
fmjvslkbtvComplex
teyxhrxrxaComplex
zvxgoddskqComplex
lvvulqxhwwComplex
mgivsgjphhComplex
Standard 12
tovmprfzvtStandard
dabrtpcbslStandard
cqydcpbvncStandard
ebklbhsczzStandard
ywpyubijlbStandard
nfmygqadtgStandard
bzfplivpzoStandard
mjsfjakvfxStandard
yllclasixwStandard
gvrgnzzwliStandard
udqsvdinyoStandard
jvenfzhqzdStandard
Show Code
DataGrid.razor
@inject IDwsSnackbarNotificationService SnackbarNotification


<DwsDataGrid Name="DataGridDemo_GroupingGrid" T="ExampleDataElement" Items="@_elementsForExample5" Title="Grouping" GroupByField="Type" OnGroupToggled="OnGroupToggled" PageSizeOptions="@_pageSizeOptionList" InitialPageSize="23">
    <DwsDataGridColumns>
        <DwsDataGridColumn Name="DataGridDemoGroupingGrid_Column_Name" T="ExampleDataElement" Field="Name" Title="Name" Sortable="true" />
        <DwsDataGridColumn Name="DataGridDemoGroupingGrid_Column_Type" T="ExampleDataElement" Field="Type" Title="Type" Alignment="DwsHorizontalAlignment.Center" />
    </DwsDataGridColumns>
</DwsDataGrid>
DataGrid.razor.cs

private static readonly List<int> _pageSizeOptionList = new() { 23, 52, 101 };
private List<ExampleDataElement> _elementsForExample5 = ExampleDataElement.GenerateExampleList(23);

private void OnGroupToggled(string groupKey)
{
    SnackbarNotification.ShowSnackbar($"Group toggled: {groupKey}", DwsSnackbarLevel.Info, "OnGroupToggled");
}

Interface-Description

Name Typ Default Description
IsProviderMode bool false True while an 'ItemsProvider' is set.
TotalItemCount int 0 Rows in the whole result: the provider's TotalCount in server-side mode, otherwise the number of filtered items. Usable from a 'PaginationTemplate'.
IsLoadingItems bool false True while a call to 'ItemsProvider' is running (the base IsComponentLoading state).
LoadError Exception? null The exception of the last failed 'ItemsProvider' call, null once a call succeeded.
Name Typ Parameters Description
ScrollBodyToTopAsync Task Scrolls the table body to the first row (only with 'Virtualize' and 'Height'/'MaxHeight', where the body itself scrolls). A page change does this automatically.
BeginCellEditAsync Task<bool> T item, string field Cell mode: opens the editor of the cell of an item in the column known by a field name ('Field' or the member path of 'Property'). false when the cell is not on the current page, not editable, vetoed by 'OnCellEditing', or another cell's invalid value keeps its editor open.
CommitCellEditAsync Task<bool> Cell mode: validates and commits the open cell editor. false when the value is invalid (the editor stays open).
CancelCellEditAsync Task Cell mode: closes the open cell editor and puts the value back.
ClearAllColumnFilters void Clears the filter of every column of the filter row ('ShowColumnFilterRow') and goes back to the first page. 'HasColumnFilters' tells whether any is set.
GetLayout DwsDataGridLayout The columns' current order, widths and visibility (columns without a 'Field' are left out). Plain data; serializes to JSON.
ApplyLayoutAsync Task DwsDataGridLayout? layout Puts a layout back. Entries for columns that no longer exist are ignored; columns the layout does not know follow after the known ones. Does not raise 'OnLayoutChanged'.
ResetLayoutAsync Task Goes back to the layout the page declares, removes the one stored by 'PersistLayout' and raises 'OnLayoutChanged'.
AutoFitColumnAsync Task string field Sets a column to the width of its widest content (header or a rendered cell), as a double-click on its resize handle does. Limits: the column's 'MinWidth' (40 px without one) and 1200 px.
AutoFitAllColumnsAsync Task Fits every visible column to its content.
RefreshAsync Task bool resetPage Asks the data source again: with an 'ItemsProvider' it is called with the current page, page size, sort, search and filters (a call still running is cancelled) and the task completes when the answer - or the error state - is shown. Call it after anything the provider reads changed outside the grid. Without a provider it only re-renders.
Name Typ Default Description
Items IEnumerable<T> null The items displayed in the table.
HeaderClass string string.Empty CSS class for the table header.
FooterClass string string.Empty CSS class for the table footer.
Title string string.Empty The title of the table.
TitleContent RenderFragment default The title content of the table.
DwsDataGridColumns RenderFragment default The columns of the table.
Searchable bool false Whether the table is searchable.
Selectable bool false Whether the rows of the table are selectable.
Deselectable bool false Whether rows can be deselected.
MultiSelect bool false Whether multiple selection is allowed.
RangeSelection bool true With 'MultiSelect': Shift+click selects every row between the last clicked row (the anchor) and the clicked one, in the order shown; with 'KeyboardNavigation', Shift+Arrow Up / Down extends the selection with the focus. false: Shift is ignored.
PersistLayout bool false Keeps the column layout (order, widths, hidden columns) in the browser's localStorage and restores it after the first render.
LayoutStorageKey string? null The localStorage key 'PersistLayout' uses. Default: dws-datagrid.{Name}.layout.
SingleDetailEntryView bool false 'DetailViewMode' Single: true shows the card only while exactly one row is selected (the context's Item is that row); false shows one card for the whole selection (the context's SelectedItems).
DetailViewMode DwsDetailViewMode DwsDetailViewMode.None Detail cards of the selected rows in the footer, rendered from 'DetailCardTemplate': one card per selected row (Multi) or one for the selection (Single).
DetailCardTemplate RenderFragment<DwsCellContext<T>>? null The content of a detail card of the selection ('DetailViewMode' Single / Multi). For a detail row under a data row use 'RowDetailTemplate'.
SearchOpenByDefault bool false Whether the search bar is open by default.
ShowTitle bool true Whether the title is shown.
ShowFooter bool true Whether the footer is shown.
StickyHead bool true Whether the table header is sticky.
StickyFoot bool true Whether the table footer is sticky. With 'Virtualize' and a height, only the pagination bar stays fixed.
Width int? null The width of the table.
MinWidth int? null The minimum width of the table.
MaxWidth int? null The maximum width of the table.
Height int? null The height of the table.
MaxHeight int? null The maximum height of the table.
MinHeight int? null The minimum height of the table.
Inline bool false Whether the table is displayed inline.
Dense bool false Whether the table is displayed in a compact layout.
ShowDensityToggle bool false Offers the row density (comfortable / compact) in the grid's 'More actions' menu.
MobileLayout DwsDataGridMobileLayout Auto How rows are laid out on a narrow grid: Auto shows cards below 'CardsBreakpoint' (the grid's own width), Cards always, Scroll never (the table scrolls sideways). In card layout sorting and the column filters move into the filter panel.
CardsBreakpoint int 576 The grid width in pixels below which MobileLayout Auto shows cards.
ShowLayoutToggle bool true While a MobileLayout Auto grid is narrow, its toolbar offers a switch between the cards and the table, which then scrolls sideways.
ItemKey Func<T, object>? null The identity of a row, used as its @key (e.g. item => item.Id). Set it when a column template renders named components per row: a row that shows another item after sorting, filtering or paging gets new components instead of renamed ones, which logged 'Duplicate component namespace'. Without it, rows are matched by position.
PreferTableView bool false A narrow MobileLayout Auto grid shows the table (scrolling sideways) instead of cards. Two-way bindable with 'PreferTableViewChanged', so the user's choice can be kept.
Virtualize bool false Renders only the visible rows of the current page (plus overscan). Requires 'Height' or 'MaxHeight': the table body then becomes the scroll container, and the header row and pagination bar stay fixed; the summary row, detail views and 'FooterContent' scroll with the rows. Without a height nothing is virtualized: every row of the page is rendered and a warning is logged once. Virtualization works per page - increase 'InitialPageSize' for large lists.
ExportPDF bool false Whether the table can be exported as PDF.
PageSizeOptions List<int> new List<int> { 25, 50, 100 } Options for the page size.
InitialPageSize int 25 The initial page size.
PageQueryParameter string? null Link mode for paging: the query parameter (?page=3, 1-based) naming the initial page. Under static SSR the pager is links that set it; without it only the range text is rendered there.
SortQueryParameter string? null Link mode for sorting: the query parameter (?sort=Name, ?sort=-Name descending) naming the initial sort. Under static SSR sortable headers are links that cycle it; without it they are plain text there. Only a sortable column's field is taken from the address.
SearchQueryParameter string? null Link mode for searching: the prefix of the query parameters (?search-Name=anna), one per searchable column field. Under static SSR the search panel is a GET form that sets them (text, number, date and time fields) and the search raises OnSearch / SearchParametersChanged as typing would, so filter the rows there or in the ItemsProvider; without it there is no search panel there. Interactive, the address only gives the initial search.
HighlightedRowsIndex List<int> new List<int>() Indexes of the highlighted rows.
HighlightedRowsClass string highlight_row CSS class for highlighted rows.
HighlightedRowsStyle string? null CSS style for highlighted rows.
Loading bool false Whether the table is loading.
CurrentPage int 0 The page shown, 0-based. Two-way bindable (@bind-CurrentPage), e.g. to keep the page in the URL. Without a binding it only takes effect when its value changes, so a parent that re-renders with the same literal does not pull the user back.
PageSize int InitialPageSize Rows per page. Two-way bindable (@bind-PageSize); not set (or 0) the grid starts with 'InitialPageSize'. Reading it gives the size in use. Like 'CurrentPage' it only takes effect when its value changes.
ItemsProvider Func<DwsDataGridRequest, CancellationToken, Task<DwsDataGridResult<T>>>? null Server-side mode: loads the rows page by page instead of taking them through 'Items'. The grid then pages, sorts, searches and filters nothing itself - every change calls the provider (DwsDataGridRequest: 0-based Page, PageSize, Skip, SortDefinitions, SearchParameters, ColumnFilters, GroupByField) and the pager uses DwsDataGridResult.TotalCount. The token is cancelled when a newer request replaces this one; a late answer is ignored. 'Items' is ignored while a provider is set. In this mode select-all, CSV/JSON/PDF export and grouping work on the loaded page, and column summaries show DwsDataGridResult.Summaries.
SearchDebounceMilliseconds int 500 Milliseconds the grid waits after a sidebar search before it raises 'OnSearch', and - with an 'ItemsProvider' - after a search or a keystroke in the column filter row before it asks the provider. A newer entry within that time replaces the pending one; 0 searches at once.
LoadErrorContent RenderFragment<Exception>? null Replaces the default message and retry button shown when 'ItemsProvider' failed. Call 'RefreshAsync' to try again.
SelectedItems List<T> default The selected items.
ActiveSortDefinition DwsSortDefinition new DwsSortDefinition() The active sort definition.
SearchParameters DwsSearchParametersSet? default The search parameters.
FooterStringForOnePage string string.Empty Optional consumer-side override text for the footer with one page (placeholder '#'). Empty = localized default text.
FooterStringForMultiPages string string.Empty Optional consumer-side override text for the footer with multiple pages (placeholders '#'/'*'). Empty = localized default text.
PdfAuthor string string.Empty The author written into the metadata of the exported PDF document.
LoadingContent RenderFragment? null Optional custom loading indicator instead of the default spinner while 'Loading' is true.
EmptyStateContent RenderFragment? null Optional custom content instead of the default empty message when 'Items' is empty.
FooterContent RenderFragment? null Optional additional content appended to the default footer (e.g. totals/summaries).
ShowRefreshButton bool false Shows a refresh button in the title bar that raises 'OnRefresh'.
ShowColumnVisibilityToggle bool false Shows a button for showing/hiding columns.
ExportCSV bool false Shows a button that exports the currently filtered/sorted rows as CSV.
CsvExportByteOrderMark bool true Starts the CSV file with a UTF-8 byte-order mark, which Excel needs to read umlauts and other non-ASCII letters correctly.
CsvExportFormulaGuard bool true Puts a single quote in front of a text value (or column title) that starts with =, +, -, @, a tab or a carriage return, so a spreadsheet shows it as text instead of running it as a formula. Numbers such as -5 from numeric columns are not changed.
ExportJSON bool false Shows a button that exports the currently filtered/sorted rows as JSON.
ExportFileName string export File name (without extension) for the CSV/JSON export download.
MultiColumnSort bool false Enables multi-column sorting: Shift+click on a column header adds it to the active sort instead of replacing it.
ActiveSortDefinitions List<DwsSortDefinition> new() The active multi-column sort in priority order. Takes precedence over 'ActiveSortDefinition' as soon as it is not empty.
ColumnResizing bool false Shows drag handles on the right edge of each sortable/resizable column header for adjusting the column width (respecting the column's 'MinWidth').
RowClass Func<T, string>? null Optional CSS class computed per row (e.g. conditional formatting based on the record).
RowStyle Func<T, string>? null Optional inline CSS style computed per row.
RowTooltip Func<T, string>? null Optional tooltip text computed per row (title attribute).
ColumnReordering bool false Enables drag & drop on the column headers to reorder columns (see 'DwsDataGridColumn.Reorderable').
KeyboardNavigation bool false Enables roving keyboard navigation between the data cells (arrow keys, Home/End, Page Up/Down) plus ARIA grid/row/gridcell roles and 'aria-sort'.
EnableContextMenu bool false Enables the row context menu, a composed DwsContextMenu built from 'ContextMenuItems': right-click, a long press on a touch screen, or the context menu key / Shift+F10 on a focused cell.
ContextMenuItems List<DwsDataGridContextMenuItem<T>> new() Entries of the row context menu: Label, Icon, Shortcut (a hint), Color, OnClick(item), IsVisible(item) and IsDisabled(item). (ContextMenuTemplate was removed in 0.1.5: the menu is a DwsContextMenu.)
ShowColumnFilterRow bool false Shows a row of per-column quick filter text fields below the table header (can be combined with sorting and search).
ShowClearAllFiltersButton bool true While a filter of the filter row ('ShowColumnFilterRow') is set, a line under that row shows the number of filtered columns and a 'Clear all filters' button; after a click the focus is on the first filter field and the result is announced. The line is not there without a filter. False: neither is shown - call ClearAllColumnFilters() from a button of your own.
ShowFirstLastPageButtons bool true Shows/hides the 'First page'/'Last page' buttons of the default pagination.
ShowPageSizeSelector bool true Shows/hides the page size selector of the default pagination regardless of the record count.
PaginationTemplate RenderFragment<DwsDataGrid<T>>? null Replaces the entire default pagination bar; the context is the table itself ('NavigateTo', 'CurrentPage', 'NumPages', ...).
GroupByField string? null Groups the rows of the current page by the value (converted to text) of this column field, with collapsible group header rows.
DefaultGroupsExpanded bool true Whether groups start expanded or collapsed with 'GroupByField'.
EnableRowEditing bool false Enables inline row editing with DataAnnotations validation (see 'DwsDataGridColumn.Editable'/'EditTemplate').
EditMode DwsDataGridEditMode DwsDataGridEditMode.Row Row: whole rows are edited ('EnableRowEditing'). Cell: single cells are edited in place and the cells take the keyboard focus - F2, Enter, a double-click or typing opens the focused cell's editor, Enter commits, Tab / Shift+Tab commit and open the next / previous editable cell, Escape cancels, a click elsewhere commits. The value is validated on commit (the property's DataAnnotations, and that the text is a value of the column's type); while it is invalid the editor stays open with its message. The row's edit buttons and row events are not used in cell mode.
DwsDataGridColumn.Property Expression<Func<T, object?>>? null On a column: its value as an expression ('p => p.Price', nested 'p => p.Address.City', or a calculation). Read through a delegate compiled once instead of reflection per cell, for cells, sorting, filtering, grouping, summaries, export and editing (a member path can be written, a calculation cannot). Without 'Field' the column is known by the member path ('Address.City'), a calculation by the column's Name. 'Field' keeps working; it may be a nested path too.
RowDetailTemplate RenderFragment<DwsCellContext<T>>? null Content of a collapsible detail row under each row (with a CSS transition). The grid adds the expand column itself; its button carries aria-expanded.
RowDetailDisabled Func<T, bool>? null Rows this returns true for cannot be expanded: their expand button is disabled (a row without details).
RowKeySelector Func<T, object>? null Computes a stable identity key per row so that, for example, the expanded state of 'RowDetailTemplate' survives replacing 'Items'.
EnableRowDragDrop bool false Enables native HTML5 drag & drop on rows (see 'OnRowDragStart'/'OnRowDrop').
DataVersion int default Increment to re-evaluate the table after an external data update without losing sorting/filters/selection. When 'Items' is an 'ObservableCollection&lt;T&gt;', the table also reacts to 'CollectionChanged' automatically.
Name Typ Description
ActiveSortDefinitionChanged EventCallback<DwsSortDefinition> Raised with the new primary sort when the user changes the sort.
ActiveSortDefinitionsChanged EventCallback<List<DwsSortDefinition>> Raised with the new sort definitions when the user changes the sort.
OnColumnOrderChanged EventCallback<List<string>> An event raised with the new field order after a column header is dragged and dropped.
OnLayoutChanged EventCallback<DwsDataGridLayout> Raised after the user resized, fitted, reordered, showed or hid a column, with the whole layout: Columns in the order shown, each with Field, Width (px, null while never resized) and Hidden.
OnGroupToggled EventCallback<string> An event raised with the group key when a group header row is expanded or collapsed.
OnRowEditing EventCallback<T> An event raised when a row enters edit mode.
OnRowSaved EventCallback<T> An event raised after a row's edits have passed DataAnnotations validation and been applied.
OnRowEditCancelled EventCallback<T> An event raised when an ongoing row edit is cancelled.
OnCellEditing EventCallback<DwsDataGridCellEditArgs<T>> Cell mode: raised before a cell's editor opens (Item, Column, Field, OldValue). Set 'Cancel' to keep this cell read-only; Tab then passes it over.
OnCellSaved EventCallback<DwsDataGridCellEditArgs<T>> Cell mode: raised after a changed value passed validation and was written to the item, with Item, Column, Field, OldValue and NewValue. Not raised when the value did not change. 'OnAuditEntry' is raised as well.
OnCellEditCancelled EventCallback<DwsDataGridCellEditArgs<T>> Cell mode: raised when a cell edit was cancelled with Escape and the value put back.
OnAuditEntry EventCallback<DwsDataGridAuditEntry<T>> An event per changed field when a row edit is saved, plus once per row on 'DeleteRowAsync' - it is only a logging event; the table itself stores nothing.
OnRowDeleted EventCallback<T> An event raised after 'DeleteRowAsync' so the caller can remove the item from its own data source.
OnRowDragStart EventCallback<T> An event raised when the user starts dragging a row (requires 'EnableRowDragDrop').
OnRowDrop EventCallback<DwsDataGridRowDropEventArgs<T>> An event raised when a dragged row is dropped on a row of this table (requires 'EnableRowDragDrop').
OnRowActivate EventCallback<T> An event raised when the focused row is activated by keyboard (Enter/Space) while 'KeyboardNavigation' is active.
OnSortChanged EventCallback<List<DwsSortDefinition>> An event raised when the active (single or multi-column) sort changes.
OnRefresh EventCallback An event raised when the refresh button is clicked. The table sets 'Loading' meanwhile. With an 'ItemsProvider' the grid then asks the provider again ('RefreshAsync').
CurrentPageChanged EventCallback<int> Raised with the new 0-based page when the user (or the grid itself) changes the page.
PageSizeChanged EventCallback<int> Raised with the new page size when the user picks another one in the footer.
DenseChanged EventCallback<bool> Raised with the new density when the user picks it in the 'More actions' menu (ShowDensityToggle); use @bind-Dense to keep it.
PreferTableViewChanged EventCallback<bool> Raised with the new value when the user switches a narrow grid between cards and table; use @bind-PreferTableView to keep it.
OnLoadError EventCallback<Exception> Raised when 'ItemsProvider' throws. The grid shows its error state with a retry button either way.
OnSearch EventCallback<DwsSearchParametersSet> An event raised when a search is performed.
OnResetSearch EventCallback An event raised when the search is reset.
OnKeyUp EventCallback<KeyboardEventArgs> An event raised when a key is released.
OnKeyDown EventCallback<KeyboardEventArgs> An event raised when a key is pressed.
LoadingChanged EventCallback<bool> An event raised when the loading state changes.
SearchParametersChanged EventCallback<DwsSearchParametersSet> An event raised when the search parameters change.
OnDblClickRow EventCallback<T> An event raised when a row is double-clicked.
OnClickRow EventCallback<T> An event raised when a row is clicked.
SelectedItemsChanged EventCallback<List<T>> An event raised when the selected items change.
Name Typ Default Description
Element ElementReference The associated web component. May be null if accessed before the component is rendered.
ComponentGuid Guid Unique identifier for the component.
TypeString string The name of the component type, obtained from reflection.
Authorized_RegisterEnabled bool false Indicates whether this component is enabled through a permission registry.
Authorized_RegisterSelected bool false Indicates whether this component is selected in permission selection mode.
GetInitializedState bool false Returns whether the component is initialized.
GetRenderModeState DwsRenderMode Returns the current render mode.
GetComponentState DwsComponentStateType Returns the current component state.
GetIsInteractiveState bool false Returns whether the component is interactive.
GetIsPrerenderingState bool false Returns whether the component is prerendering.
GetComponentLoadingState bool false Returns whether the component is loading.
IsFormBusy bool false Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState).
Name Typ Parameters Description
DebugInfo void Logs debug information about the component.
UpdateState void Updates the component's state and triggers StateHasChanged.
UpdateStateAsync Task Asynchronously updates the component's state and triggers StateHasChanged.
Dispose void Disposes the component and releases resources.
FocusAsync ValueTask bool containedInScrollableList Sets focus to the component's element.
Name Typ Default Description
Name string Required unique identifier for the component within its container.
Visible bool true Determines if the component is visible in the UI.
Disabled bool false Disables the form control, ensuring it doesn't participate in form submission.
ComponentNameSpace string The namespace for permission-based access control.
PermissionKey string? null A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins.
Class string Optional CSS class names.
Style string Optional in-line styles.
Tag object An optional user-defined object to store any additional data with the component.
BackReference DwsReference A reference to the enclosing component.
ID string The HTML ID attribute for the component.
AdditionalAttributes Dictionary<string, object> Additional HTML attributes for the component's root element.
IgnorePermissionChecks bool false Bypasses all permission checks for this component.
IgnorePermissionSelection bool false Ignore permission selection mode for this component.
IgnoreFormBusy bool false Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it.
Name Typ Description
OnInitializedCallbackStarted EventCallback Callback when OnInitialized starts.
OnInitializedCallback EventCallback Callback during OnInitialized.
OnInitializedCallbackCompleted EventCallback Callback when OnInitialized completes.
OnInitializedAsyncCallbackStarted EventCallback Callback when OnInitializedAsync starts.
OnInitializedAsyncCallback EventCallback Callback during OnInitializedAsync.
OnInitializedAsyncCallbackCompleted EventCallback Callback when OnInitializedAsync completes.
OnIsComponentLoadingChanged EventCallback<bool> Callback when IsComponentLoading changes.
OnCurrentRenderModeChanged EventCallback<DwsRenderMode> Callback when CurrentRenderMode changes.
OnComponentStateChanged EventCallback<DwsComponentStateType> Callback when ComponentState changes.
An error has occurred. This app may no longer respond until reloaded.