Skip to content

Extras

DataGrid

Bit.BlazorUI.ExtrasDataTableTreeGridTreeList

BitDataGrid displays an information-rich data table and gives people the tools to work through it: sorting, quick search and per-column filters, paging, grouping with aggregates, selection, inline editing, resizable/reorderable/frozen columns, master-detail and tree rows, keyboard cell navigation, row and column virtualization, and CSV/Excel export. Bind a list, an IQueryable executed at the source, or a callback for server-side paging or infinite scrolling. Use a data grid when information density is critical.

Columns & styling

Resizing, reordering, hiding, freezing and grouping columns, column spans, borders, stripes and row numbers, row and cell styles with tooltips, text wrapping and row height, and the empty and loading states.

Column layout

Resizable: drag a header's edge, double-click it to fit the content, or focus it and use the arrow keys (Home/End go to MinWidth/MaxWidth, Enter fits). Reorderable: drag a header, press Ctrl+←/→ on it, or use the arrows in the ShowColumnChooser panel, which also hides columns. Dragging works with touch and pen too. Frozen and FrozenEnd pin columns to an edge, and Group banners adjacent columns under one header.

MinWidth (60 px) and MaxWidth (none) bound the resize in pixels; Shift with an arrow key takes bigger steps. Resizable and Reorderable on a column override the grid's, and a disabled grid does neither. AutoFitColumnAsync and AutoFitAllColumnsAsync fit from code, measuring the rendered content and header; MoveColumnAsync moves a column to a 0-based position.

The column chooser shows and hides columns, and moves them only while the grid is Reorderable. A column's Visible (default true) sets whether it starts shown. A hidden column is left out of the exports and the clipboard too.

Frozen pins to the start edge (the left in LTR, the right in RTL) and FrozenEnd to the end edge; a column with both is Frozen. In the Excel export, the frozen columns become frozen panes. A Group header spans runs of consecutive columns with the same name, so a column moved away from the others of its group no longer sits under it.

Identity
Commercials
1
Vintage Gadget 212
Home
Wayne Enterprises
$171.75
131
2023-01-19
3.9
2
Eco Notebook 554
Clothing
Soylent
$382.16
130
2019-07-18
3.1
3
Classic Gadget 181
Toys
Wonka Inc
$813.02
269
2023-03-12
1.2
4
Vintage Blender 267
Electronics
Wayne Enterprises
$310.12
291
2021-01-25
4.3
5
Vintage Jacket 234
Electronics
Wayne Enterprises
$55.50
390
2022-08-20
3.5
6
Smart Drone 229
Electronics
Stark Industries
$603.51
257
2020-02-18
1.2
7
Eco Widget 428
Books
Wayne Enterprises
$72.97
359
2023-12-08
1.3
8
Pro Blender 549
Electronics
Acme Corp
$825.55
6
2020-06-02
1.0
9
Deluxe Mug 514
Clothing
Wayne Enterprises
$615.44
22
2021-08-11
2.5
10
Mini Jacket 367
Grocery
Initech
$585.87
367
2018-10-04
1.1
11
Vintage Gadget 192
Home
Soylent
$334.92
388
2022-10-27
1.6
12
Mini Mug 788
Toys
Acme Corp
$712.80
144
2020-06-09
3.2
13
Classic Mug 124
Books
Acme Corp
$267.79
19
2021-09-09
1.9
14
Compact Gadget 195
Clothing
Wayne Enterprises
$325.60
375
2023-10-09
4.3
15
Deluxe Speaker 932
Sports
Initech
$281.65
272
2022-12-13
3.5
16
Eco Widget 307
Grocery
Initech
$982.55
390
2022-12-24
1.5
17
Mini Blender 740
Electronics
Wonka Inc
$597.20
195
2022-02-04
4.5
18
Pro Blender 952
Sports
Stark Industries
$132.04
53
2018-11-08
1.0
19
Classic Drone 459
Electronics
Soylent
$906.58
481
2022-03-05
4.6
20
Mega Mug 839
Sports
Wonka Inc
$282.70
169
2022-08-25
3.1
21
Mega Speaker 349
Books
Wonka Inc
$830.28
320
2019-08-05
1.3
22
Modern Mug 947
Home
Stark Industries
$886.86
484
2022-11-05
1.6
23
Mini Backpack 199
Sports
Wayne Enterprises
$349.39
260
2021-02-06
3.9
24
Mini Speaker 940
Electronics
Initech
$60.13
107
2022-05-29
2.3
25
Deluxe Lamp 430
Home
Initech
$760.77
331
2019-04-24
5.0
26
Eco Mug 633
Toys
Initech
$388.23
478
2019-03-07
1.3
27
Compact Camera 900
Electronics
Stark Industries
$300.37
290
2021-10-02
1.1
28
Mega Mug 366
Grocery
Stark Industries
$749.69
15
2023-10-08
2.4
29
Mini Jacket 409
Books
Acme Corp
$604.08
321
2020-05-11
3.4
30
Premium Camera 361
Grocery
Globex
$352.80
0
2023-02-25
3.3
31
Mega Gadget 949
Books
Initech
$654.24
99
2019-04-16
3.6
32
Mega Lamp 485
Books
Stark Industries
$787.62
277
2021-10-01
3.2
33
Compact Backpack 302
Clothing
Wayne Enterprises
$540.00
406
2020-10-10
3.8
34
Pro Mug 551
Grocery
Umbrella
$45.94
206
2020-12-02
2.7
35
Ultra Mug 514
Clothing
Wayne Enterprises
$484.40
357
2022-12-21
2.7
36
Pro Camera 944
Home
Wayne Enterprises
$211.34
473
2020-07-01
4.5
37
Mini Notebook 156
Electronics
Umbrella
$900.67
312
2023-02-28
4.7
38
Premium Jacket 198
Electronics
Wayne Enterprises
$651.34
10
2019-06-22
1.9
39
Classic Drone 215
Sports
Acme Corp
$290.56
272
2020-06-08
1.2
40
Mini Sneaker 570
Sports
Wayne Enterprises
$897.23
338
2021-10-15
4.6

Column spanning

ColSpan lets a cell cover the next columns of its row: a discontinued product's name spans Category, and a premium price spans Stock. Assistive technologies get the span through aria-colspan.

The function returns how many columns the cell covers, counted in the visible columns from its own; null, 1 or anything below 1 covers just its own, and a span past the last column stops there. The covered cells are not rendered, so their values do not show in that row - render what the row needs in the spanning cell's Template, as here. Keyboard navigation steps over a span as one cell, and the Excel export writes it as a merged region. Hiding or reordering columns changes what a span covers. While any column has a ColSpan, VirtualizeColumns is not applied.

1
Vintage Gadget 212
Home
$171.75
131
2
⚠ Eco Notebook 554 - discontinued
$382.16
130
3
Classic Gadget 181
Toys
★ Premium: $813.02 · 269 in stock
4
⚠ Vintage Blender 267 - discontinued
$310.12
291
5
⚠ Vintage Jacket 234 - discontinued
$55.50
390
6
Smart Drone 229
Electronics
$603.51
257
7
Eco Widget 428
Books
$72.97
359
8
⚠ Pro Blender 549 - discontinued
★ Premium: $825.55 · 6 in stock
9
⚠ Deluxe Mug 514 - discontinued
$615.44
22
10
Mini Jacket 367
Grocery
$585.87
367
11
⚠ Vintage Gadget 192 - discontinued
$334.92
388
12
Mini Mug 788
Toys
$712.80
144
13
Classic Mug 124
Books
$267.79
19
14
⚠ Compact Gadget 195 - discontinued
$325.60
375
15
Deluxe Speaker 932
Sports
$281.65
272
16
Eco Widget 307
Grocery
★ Premium: $982.55 · 390 in stock
17
Mini Blender 740
Electronics
$597.20
195
18
⚠ Pro Blender 952 - discontinued
$132.04
53
19
⚠ Classic Drone 459 - discontinued
★ Premium: $906.58 · 481 in stock
20
Mega Mug 839
Sports
$282.70
169
21
Mega Speaker 349
Books
★ Premium: $830.28 · 320 in stock
22
Modern Mug 947
Home
★ Premium: $886.86 · 484 in stock
23
Mini Backpack 199
Sports
$349.39
260
24
⚠ Mini Speaker 940 - discontinued
$60.13
107
25
Deluxe Lamp 430
Home
$760.77
331
26
Eco Mug 633
Toys
$388.23
478
27
Compact Camera 900
Electronics
$300.37
290
28
Mega Mug 366
Grocery
$749.69
15
29
Mini Jacket 409
Books
$604.08
321
30
Premium Camera 361
Grocery
$352.80
0
31
Mega Gadget 949
Books
$654.24
99
32
Mega Lamp 485
Books
$787.62
277
33
Compact Backpack 302
Clothing
$540.00
406
34
⚠ Pro Mug 551 - discontinued
$45.94
206
35
⚠ Ultra Mug 514 - discontinued
$484.40
357
36
Pro Camera 944
Home
$211.34
473
37
Mini Notebook 156
Electronics
★ Premium: $900.67 · 312 in stock
38
Premium Jacket 198
Electronics
$651.34
10
39
⚠ Classic Drone 215 - discontinued
$290.56
272
40
Mini Sneaker 570
Sports
★ Premium: $897.23 · 338 in stock

Borders, striping & row numbers

Bordered, Striped and Hoverable are on by default. ShowRowNumbers numbers the rows by their place in the whole data set - page 2 starts at 9 - and is never exported.

Bordered draws the outer border and the lines between columns; the lines between rows are drawn either way. Striped shades every other row and Hoverable highlights the row under the pointer. Their colors are the --bit-DataGrid-border-color, -stripe-background and -hover-background CSS variables (see Style & Class). Row numbers keep counting across pages, a virtualized window and infinite-scroll batches, and are left out of the clipboard as well as the exports.


1
1
Vintage Gadget 212
Home
$171.75
131
2
2
Eco Notebook 554
Clothing
$382.16
130
3
3
Classic Gadget 181
Toys
$813.02
269
4
4
Vintage Blender 267
Electronics
$310.12
291
5
5
Vintage Jacket 234
Electronics
$55.50
390
6
6
Smart Drone 229
Electronics
$603.51
257
7
7
Eco Widget 428
Books
$72.97
359
8
8
Pro Blender 549
Electronics
$825.55
6
1–8 of 60
Page 1 of 8

Row & cell styling

RowClass and RowStyle style a row from its data - out-of-stock rows turn red, premium ones bold; a column's CellClassSelector and CellStyleSelector do the same for its own cells - low stock in amber. ShowCellTooltips gives every cell its full text as a tooltip (a column opts out with ShowTooltip="false"): narrow the Name column and hover a name.

Each selector is called per row and returns null for nothing extra. RowClass is added after the grid's own row classes and the Classes.Row / SelectedRow ones, and RowStyle after the row's layout style. On a column, CellClass is a fixed class for every cell, CellClassSelector adds one per row after it, and CellStyleSelector's style is applied last, so it wins over the grid's own cell styles - prefer color and font-* to background, which would hide the selected and hovered states. HeaderClass styles the column's header cell.

The classes land on elements the grid renders, so CSS isolation reaches them only through ::deep from a plain element of your page, which is why the grid sits in a div here (see the stylesheet tab). The Stock column names its TItem because it is handed a method group, from which the compiler cannot infer the row type. The tooltips only go on cells that show the column's own value - a Template draws its own.

1
Vintage Gadget 212
Wayne Enterprises
Home
$171.75
131
2
Eco Notebook 554
Soylent
Clothing
$382.16
130
3
Classic Gadget 181
Wonka Inc
Toys
$813.02
269
4
Vintage Blender 267
Wayne Enterprises
Electronics
$310.12
291
5
Vintage Jacket 234
Wayne Enterprises
Electronics
$55.50
390
6
Smart Drone 229
Stark Industries
Electronics
$603.51
257
7
Eco Widget 428
Wayne Enterprises
Books
$72.97
359
8
Pro Blender 549
Acme Corp
Electronics
$825.55
6
9
Deluxe Mug 514
Wayne Enterprises
Clothing
$615.44
22
10
Mini Jacket 367
Initech
Grocery
$585.87
367
11
Vintage Gadget 192
Soylent
Home
$334.92
388
12
Mini Mug 788
Acme Corp
Toys
$712.80
144
13
Classic Mug 124
Acme Corp
Books
$267.79
19
14
Compact Gadget 195
Wayne Enterprises
Clothing
$325.60
375
15
Deluxe Speaker 932
Initech
Sports
$281.65
272
16
Eco Widget 307
Initech
Grocery
$982.55
390
17
Mini Blender 740
Wonka Inc
Electronics
$597.20
195
18
Pro Blender 952
Stark Industries
Sports
$132.04
53
19
Classic Drone 459
Soylent
Electronics
$906.58
481
20
Mega Mug 839
Wonka Inc
Sports
$282.70
169
21
Mega Speaker 349
Wonka Inc
Books
$830.28
320
22
Modern Mug 947
Stark Industries
Home
$886.86
484
23
Mini Backpack 199
Wayne Enterprises
Sports
$349.39
260
24
Mini Speaker 940
Initech
Electronics
$60.13
107
25
Deluxe Lamp 430
Initech
Home
$760.77
331
26
Eco Mug 633
Initech
Toys
$388.23
478
27
Compact Camera 900
Stark Industries
Electronics
$300.37
290
28
Mega Mug 366
Stark Industries
Grocery
$749.69
15
29
Mini Jacket 409
Acme Corp
Books
$604.08
321
30
Premium Camera 361
Globex
Grocery
$352.80
0
31
Mega Gadget 949
Initech
Books
$654.24
99
32
Mega Lamp 485
Stark Industries
Books
$787.62
277
33
Compact Backpack 302
Wayne Enterprises
Clothing
$540.00
406
34
Pro Mug 551
Umbrella
Grocery
$45.94
206
35
Ultra Mug 514
Wayne Enterprises
Clothing
$484.40
357
36
Pro Camera 944
Wayne Enterprises
Home
$211.34
473
37
Mini Notebook 156
Umbrella
Electronics
$900.67
312
38
Premium Jacket 198
Wayne Enterprises
Electronics
$651.34
10
39
Classic Drone 215
Acme Corp
Sports
$290.56
272
40
Mini Sneaker 570
Wayne Enterprises
Sports
$897.23
338
41
Modern Camera 946
Globex
Sports
$661.07
44
42
Vintage Mug 824
Initech
Sports
$444.42
453
43
Mini Mug 925
Wonka Inc
Electronics
$843.33
173
44
Premium Camera 560
Globex
Grocery
$35.33
277
45
Vintage Gadget 237
Wonka Inc
Home
$383.48
282
46
Pro Drone 577
Initech
Electronics
$285.56
438
47
Eco Jacket 846
Wonka Inc
Grocery
$59.26
414
48
Smart Camera 226
Initech
Toys
$612.62
229
49
Classic Gadget 202
Globex
Electronics
$494.25
256
50
Mega Sneaker 417
Soylent
Sports
$955.45
169
51
Premium Gadget 932
Wayne Enterprises
Clothing
$741.93
301
52
Premium Lamp 283
Soylent
Toys
$943.60
49
53
Pro Mug 237
Initech
Toys
$264.98
237
54
Eco Lamp 139
Wonka Inc
Electronics
$175.86
112
55
Ultra Lamp 134
Wayne Enterprises
Grocery
$47.06
77
56
Ultra Blender 911
Initech
Grocery
$80.83
62
57
Ultra Gadget 323
Stark Industries
Books
$647.39
313
58
Deluxe Blender 420
Acme Corp
Home
$506.54
17
59
Deluxe Camera 513
Acme Corp
Sports
$234.18
305
60
Eco Mug 642
Umbrella
Electronics
$809.15
442

Text wrapping & row height

WrapCellText wraps long values (and headers) instead of cutting them off, and the row grows to fit; a column overrides it with WrapText. RowHeight (36) is every row's minimum height, and RowHeightSelector sets it per row - premium products here. Wrapping is off while Virtualize is on, which needs every row at exactly RowHeight.

Without wrapping, a value too long for its column is cut off with an ellipsis; ShowCellTooltips (in Row & cell styling) keeps it readable instead. WrapText="false" keeps a column on one line while the grid wraps, as the ID, Price and Stock columns do here, and WrapText="true" wraps one column of a grid that does not. Both heights are in pixels and are minimums: a row still grows to fit wrapped text. While Virtualize is on, RowHeightSelector is ignored as well and RowHeight is every row's exact height.



Description
1
Vintage Gadget 212
Vintage Gadget 212 is a home product supplied by Wayne Enterprises, released on 1/19/2023 and currently rated 3.9 out of 5 by our customers.
$171.75
131
2
Eco Notebook 554
Eco Notebook 554 is a clothing product supplied by Soylent, released on 7/18/2019 and currently rated 3.1 out of 5 by our customers.
$382.16
130
3
Classic Gadget 181
Classic Gadget 181 is a toys product supplied by Wonka Inc, released on 3/12/2023 and currently rated 1.2 out of 5 by our customers.
$813.02
269
4
Vintage Blender 267
Vintage Blender 267 is a electronics product supplied by Wayne Enterprises, released on 1/25/2021 and currently rated 4.3 out of 5 by our customers.
$310.12
291
5
Vintage Jacket 234
Vintage Jacket 234 is a electronics product supplied by Wayne Enterprises, released on 8/20/2022 and currently rated 3.5 out of 5 by our customers.
$55.50
390
6
Smart Drone 229
Smart Drone 229 is a electronics product supplied by Stark Industries, released on 2/18/2020 and currently rated 1.2 out of 5 by our customers.
$603.51
257
7
Eco Widget 428
Eco Widget 428 is a books product supplied by Wayne Enterprises, released on 12/8/2023 and currently rated 1.3 out of 5 by our customers.
$72.97
359
8
Pro Blender 549
Pro Blender 549 is a electronics product supplied by Acme Corp, released on 6/2/2020 and currently rated 1.0 out of 5 by our customers.
$825.55
6
9
Deluxe Mug 514
Deluxe Mug 514 is a clothing product supplied by Wayne Enterprises, released on 8/11/2021 and currently rated 2.5 out of 5 by our customers.
$615.44
22
10
Mini Jacket 367
Mini Jacket 367 is a grocery product supplied by Initech, released on 10/4/2018 and currently rated 1.1 out of 5 by our customers.
$585.87
367
11
Vintage Gadget 192
Vintage Gadget 192 is a home product supplied by Soylent, released on 10/27/2022 and currently rated 1.6 out of 5 by our customers.
$334.92
388
12
Mini Mug 788
Mini Mug 788 is a toys product supplied by Acme Corp, released on 6/9/2020 and currently rated 3.2 out of 5 by our customers.
$712.80
144
13
Classic Mug 124
Classic Mug 124 is a books product supplied by Acme Corp, released on 9/9/2021 and currently rated 1.9 out of 5 by our customers.
$267.79
19
14
Compact Gadget 195
Compact Gadget 195 is a clothing product supplied by Wayne Enterprises, released on 10/9/2023 and currently rated 4.3 out of 5 by our customers.
$325.60
375
15
Deluxe Speaker 932
Deluxe Speaker 932 is a sports product supplied by Initech, released on 12/13/2022 and currently rated 3.5 out of 5 by our customers.
$281.65
272
16
Eco Widget 307
Eco Widget 307 is a grocery product supplied by Initech, released on 12/24/2022 and currently rated 1.5 out of 5 by our customers.
$982.55
390
17
Mini Blender 740
Mini Blender 740 is a electronics product supplied by Wonka Inc, released on 2/4/2022 and currently rated 4.5 out of 5 by our customers.
$597.20
195
18
Pro Blender 952
Pro Blender 952 is a sports product supplied by Stark Industries, released on 11/8/2018 and currently rated 1.0 out of 5 by our customers.
$132.04
53
19
Classic Drone 459
Classic Drone 459 is a electronics product supplied by Soylent, released on 3/5/2022 and currently rated 4.6 out of 5 by our customers.
$906.58
481
20
Mega Mug 839
Mega Mug 839 is a sports product supplied by Wonka Inc, released on 8/25/2022 and currently rated 3.1 out of 5 by our customers.
$282.70
169
21
Mega Speaker 349
Mega Speaker 349 is a books product supplied by Wonka Inc, released on 8/5/2019 and currently rated 1.3 out of 5 by our customers.
$830.28
320
22
Modern Mug 947
Modern Mug 947 is a home product supplied by Stark Industries, released on 11/5/2022 and currently rated 1.6 out of 5 by our customers.
$886.86
484
23
Mini Backpack 199
Mini Backpack 199 is a sports product supplied by Wayne Enterprises, released on 2/6/2021 and currently rated 3.9 out of 5 by our customers.
$349.39
260
24
Mini Speaker 940
Mini Speaker 940 is a electronics product supplied by Initech, released on 5/29/2022 and currently rated 2.3 out of 5 by our customers.
$60.13
107
25
Deluxe Lamp 430
Deluxe Lamp 430 is a home product supplied by Initech, released on 4/24/2019 and currently rated 5.0 out of 5 by our customers.
$760.77
331
26
Eco Mug 633
Eco Mug 633 is a toys product supplied by Initech, released on 3/7/2019 and currently rated 1.3 out of 5 by our customers.
$388.23
478
27
Compact Camera 900
Compact Camera 900 is a electronics product supplied by Stark Industries, released on 10/2/2021 and currently rated 1.1 out of 5 by our customers.
$300.37
290
28
Mega Mug 366
Mega Mug 366 is a grocery product supplied by Stark Industries, released on 10/8/2023 and currently rated 2.4 out of 5 by our customers.
$749.69
15
29
Mini Jacket 409
Mini Jacket 409 is a books product supplied by Acme Corp, released on 5/11/2020 and currently rated 3.4 out of 5 by our customers.
$604.08
321
30
Premium Camera 361
Premium Camera 361 is a grocery product supplied by Globex, released on 2/25/2023 and currently rated 3.3 out of 5 by our customers.
$352.80
0
31
Mega Gadget 949
Mega Gadget 949 is a books product supplied by Initech, released on 4/16/2019 and currently rated 3.6 out of 5 by our customers.
$654.24
99
32
Mega Lamp 485
Mega Lamp 485 is a books product supplied by Stark Industries, released on 10/1/2021 and currently rated 3.2 out of 5 by our customers.
$787.62
277
33
Compact Backpack 302
Compact Backpack 302 is a clothing product supplied by Wayne Enterprises, released on 10/10/2020 and currently rated 3.8 out of 5 by our customers.
$540.00
406
34
Pro Mug 551
Pro Mug 551 is a grocery product supplied by Umbrella, released on 12/2/2020 and currently rated 2.7 out of 5 by our customers.
$45.94
206
35
Ultra Mug 514
Ultra Mug 514 is a clothing product supplied by Wayne Enterprises, released on 12/21/2022 and currently rated 2.7 out of 5 by our customers.
$484.40
357
36
Pro Camera 944
Pro Camera 944 is a home product supplied by Wayne Enterprises, released on 7/1/2020 and currently rated 4.5 out of 5 by our customers.
$211.34
473
37
Mini Notebook 156
Mini Notebook 156 is a electronics product supplied by Umbrella, released on 2/28/2023 and currently rated 4.7 out of 5 by our customers.
$900.67
312
38
Premium Jacket 198
Premium Jacket 198 is a electronics product supplied by Wayne Enterprises, released on 6/22/2019 and currently rated 1.9 out of 5 by our customers.
$651.34
10
39
Classic Drone 215
Classic Drone 215 is a sports product supplied by Acme Corp, released on 6/8/2020 and currently rated 1.2 out of 5 by our customers.
$290.56
272
40
Mini Sneaker 570
Mini Sneaker 570 is a sports product supplied by Wayne Enterprises, released on 10/15/2021 and currently rated 4.6 out of 5 by our customers.
$897.23
338

Empty & loading states

With no rows the grid shows a message, or your EmptyTemplate. Loading shows a spinner - or your LoadingTemplate - in place of the rows and marks the grid aria-busy.

Without an EmptyTemplate the message is Strings.EmptyText ("No items found") when there are no rows, and Strings.NoMatchesText ("No results found") when a filter or the search is on - the rows exist but none match. Both texts default to BitStrings.Current, read each time they are shown. An EmptyTemplate is shown in both cases, so give it wording that fits a fruitless search as well, or leave it out.

Loading hides the rows for as long as it is set rather than dimming them. A server grid (OnRead) does not need it: it marks itself busy while it reads and shows the loading row only while it has no rows yet, keeping the rows on screen while the next ones load - set Loading yourself to hide them then too. The header and toolbar stay in place. Classes.Empty / Classes.Loading (and their Styles) style the two messages.


Nothing here yet

Feedback

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.