The Blazor Data Grid is a full featured data visualization and editing component that works in both Blazor WebAssembly (WASM) and server-side Blazor apps. You can easily display large amounts of data in a table, then page, filter, sort and group over it, as well as edit rows and validate the user input.
All you need to do is provide data to the grid, enable the features you want through simple parameters and we will do the rest to ensure beautiful display and great performance. You can also tweak the visualization through templates and your own CSS styles.
The Column Menu feature simplifies access to common operations and provides your app’s users with a convenient way to apply sorting, filtering, and toggle the visible and lock states of the columns from a central spot. The menu can be further configured via the GridColumnMenuSettings tag.
The Search Box is an additional method of filtering records in a Grid, complementary to the Grid Filtering options but much simpler. To add a Search Box to your Grid, simply add a GridSearchBox to its children. Once done, users will be able to type text to immediately and intuitively filter grid elements.
With the Grid SortMode property, you can enable data sorting based on multiple grid columns. The SortMode accepts two values:
Display aggregated results in the Grid footer template for each data-bound column, commonly referred to Grand Total. This is especially useful in finance apps or internal reports where you can quickly give a summary of the data. Both of those examples aggregate values of each column and can show custom content. The footer template will always remain visible regardless of the vertical scrolling of the Grid.
Use the Grid column Visible property to programmatically control which Grid columns are visible. When a column needs to stay hidden at all times, you can directly set the column property Visible to false. However, you can also dynamically manage the column’s visibility in other cases when you need to provide conditional visibility. Check out more code samples on how to control column visibility in the Telerik UI for Blazor Grid here.
Custom filter rows and Custom filter menus are two more ways to tailor the Grid for your specific needs. They provide you with the ability to replace the built-in filters on top of each column in the Grid with a more user-friendly filter for your specific case. For example, instead of the general built-in feature for numbers which can be overwhelming, you might want to simply give the user options to pick min and max values without too much thinking.
The Telerik Blazor grid component lets your end users edit the data. They can alter or delete existing records or insert new ones—all the CRUD operations are conveniently exposed through events that give you the user action and the model, so all you have to do is add your business logic and call your data service.
The grid also offers three built-in editing modes:
Popup (which also offers built-in integration with the DataAnnotations Forms Validation)
Inline where the entire row is being edited and saved at the same time,
InCell which lets you quickly edit only a certain field and send up the changes.
You can group the grid according to the values in different fields to see relationships between them, aggregates over the given groups and nest groups within groups to explore the data. Just set the Groupable parameter to true and you can simply drag the column headers to group by them.
The Telerik Blazor Data Grid lets you customize what renders in cells, editors and various headers and footers so you can tweak it according to your needs and to also show extra data.
You can define:
Special content for the cells – from specific formatting for a string or number, to entire components like charts and tooltips can go into each data cell.
Your own editors – while the grid offers built-in editors according to the field type, you can define your own where you can implement further logic, rendering and appearance.
Column header – when the field name is not enough and you want to add something more – from multiline text, to actionable buttons.
Column Group footer – a great place to add aggregates information (which the grid provides for you).
Group header – more descriptions about the current grouping level, including data aggregates.
The entire row rendering – you can render your own HTML, down to the <td> elements, instead of the grid.
The Telerik UI for Blazor Grid component dispatches the OnCellRender event when any of the Grid columns is rendered. The event is raised for every cell in the column and is given information about the items for which the current cell is being used. Use this event to conditionally format the styling classes of the cell.
The Grid can print any value type with a custom display format to improve the readability of values. The display format can be specified either by adding an attribute on the data member in the class or by adding an attribute to the GridColumn tag.
The Telerik UI for Blazor Grid can also use data from a weakly-typed ExpandoObject. This is often the case when connecting to a backend based on older technologies and usually makes integration much harder the Grid takes care of it.
In addition to the row virtualization, you can add easily enable virtualization of the Grid columns. And the great thing is that you can have both rows and columns simultaneously virtualized for optimal performance when dealing with large volume of data rows and columns in your Blazor Grid.
When you declare the columns in a grid, you would usually put the most important ones first. A user may have a different need, task or preference, though, and the Telerik Blazor Grid lets them rearrange columns to fit their needs.
Whenever a row in the Grid is clicked or double-clicked, the corresponding event is fired and you can handle it to do interesting things like showing a detailed view of that row in a separate control or fetching/sending more data about this particular item to the server.
To simplify Grid columns definition, you can benefit from the automatic column generation feature. For cases when you want to display a list of columns in a Grid that are an exact match to your data model you can visualize, update, delete and insert records without extra overhead – all you have to do is set the Grid AutoGenerateColumns parameter to “true”.
Grid automatically generated columns work well together with column virtualization in Blazor Grid.
In a grid with many columns, the users often scroll to the left and right and want to keep certain important columns visible at all times – such as IDs, command column to edit, selection column, or anything else of value. The Telerik Blazor grid brings the Excel Frozen Columns feature to the web with even more flexibility – you can keep columns frozen in the beginning, at the end, and even columns from the middle of the grid can be always visible and stick to one end.
At the end of the day, people want to shut down their computers, then come back tomorrow exactly where they left off. The Telerik Blazor grid lets them have this experience in a web app by saving and loading its state from any storage. Every user action that changes the grid display (such as paging, filtering, even editing) fires up an event that you can use to record its state so you can restore it as-is when the user logs back in, or even on the click of a button.
Grid State also lets you invoke these operations from other places in your app logic. For example, if something else happens in the app, you can tell the grid to filter by a certain field and value, or to go back to the first page.
Grid State Management examples – persist (save and load), and change programmatically.
Thanks to the out-of-the-box support of complex (nested, navigation) properties, the Telerik Blazor Grid can be bound to both primitive types and complex model objects.
The row has a lot of details, but not all of them are important. Hide them in the Detail Template so the user can expand the row and see them when needed, without cluttering the main table.
The hierarchy feature of the grid is flexible and lets you drill down into data, expand and collapse the rows you want to look into and show data on demand. You can devise any layout you want, and put a grid there to showcase hierarchical relationship between the nested grid and its parent row.
Users in both Blazor server-side and WebAssembly applications can easily export Grid data to Excel with a click of a button. The exported file will preserve the Grid settings, so that filtering, sorting, paging, grouping, column order and column size are applied to data in the xlsx document. The export allows developers to set the resulting file name and configuration of the data to be exported – current shown page or all pages in the grid.
Large data sets are commonly split into smaller pages of date for the convenience of your end users and to improve your app performance. The grid can do this for you automatically, just enable a single property.
When users highlight a certain row, you can use that information to show more data, other components or simply collect a list of their choices. The grid exposes all of this through single and multiple row selection modes, and also lets you select all items on the current page or across the entire grid, which comes in handy for batch operations like deleting many records at once, or moving data from one place (or state) to another.
The selected items offer a lot of flexibility – you can use two-way binding to predefine items or get your collection updated automatically; or you can consume an event so you can react to user activity and update your app.
In the simplest case, you just point the data parameter of the Blazor Grid to your data collection and define the columns you want in it. The grid will do everything else for you (paging, sorting, filtering and so on).
The Telerik UI for Blazor Grid can also use data from a DataTable object. This makes it easier to connect with legacy code which is still using DataTables.
You can improve performance by loading only the current page of data on demand using an IQueriable collection powered by EntityFramework (for a server-side Blazor app), or implementing your own data operations through the OnRead event (applies to both WASM and server-side Blazor). The custom data loading also applies to all other grid features such as paging, filtering and virtual scrolling, so you can make the most efficient database queries.
The Telerik Blazor Grid responds to the user culture automatically – for example, formats in numeric inputs and date inputs use the current user culture, and strings such as pager tooltips and command buttons’ texts can be easily translated.
Users with disabilities need to use your site as well, and the Telerik Grid component helps in that regard – it uses semantic markup and covers the current accessibility standards (including WCAG, Section 508 and WAI-ARIA attributes for screen readers). Moreover, you can navigate around the grid and invoke all actions with the keyboard alone.