New to Telerik UI for Blazor? Download Free 30-day trial
Grid - Sorting
- EXAMPLE
- VIEW SOURCE
- EDIT IN TELERIK REPL
- Change Theme
default
The second grid allows sorting by multiple fields. For example, try setting descending sorting on the "Discontinued" column, then sort by another column to see the difference in behavior with single-column sorting.
Grid with sorting enabled for a single column.
ID | Product Name | Price | In stock | Quantity per unit | Discontinued |
---|
1 | Chai | 18 | 39 | 10 boxes x 20 bags | False |
2 | Chang | 19 | 17 | 24 - 12 oz bottles | False |
3 | Aniseed Syrup | 10 | 13 | 12 - 550 ml bottles | False |
4 | Chef Anton's Cajun Seasoning | 22 | 53 | 48 - 6 oz jars | False |
5 | Chef Anton's Gumbo Mix | 21.35 | 0 | 36 boxes | True |
6 | Grandma's Boysenberry Spread | 25 | 120 | 12 - 8 oz jars | False |
7 | Uncle Bob's Organic Dried Pears | 30 | 15 | 12 - 1 lb pkgs. | False |
8 | Northwoods Cranberry Sauce | 40 | 6 | 12 - 12 oz jars | False |
9 | Mishi Kobe Niku | 97 | 29 | 18 - 500 g pkgs. | True |
10 | Ikura | 31 | 31 | 12 - 200 ml jars | False |
Grid with sorting enabled for multiple columns.
ID | Product Name | Price | In stock | Quantity per unit | Discontinued |
---|
1 | Chai | 18 | 39 | 10 boxes x 20 bags | False |
2 | Chang | 19 | 17 | 24 - 12 oz bottles | False |
3 | Aniseed Syrup | 10 | 13 | 12 - 550 ml bottles | False |
4 | Chef Anton's Cajun Seasoning | 22 | 53 | 48 - 6 oz jars | False |
5 | Chef Anton's Gumbo Mix | 21.35 | 0 | 36 boxes | True |
6 | Grandma's Boysenberry Spread | 25 | 120 | 12 - 8 oz jars | False |
7 | Uncle Bob's Organic Dried Pears | 30 | 15 | 12 - 1 lb pkgs. | False |
8 | Northwoods Cranberry Sauce | 40 | 6 | 12 - 12 oz jars | False |
9 | Mishi Kobe Niku | 97 | 29 | 18 - 500 g pkgs. | True |
10 | Ikura | 31 | 31 | 12 - 200 ml jars | False |
- Sorting.razor
- ProductService.cs
- ProductDto.cs
Loading the demo source code...please wait.
Description
The Telerik Grid for Blazor allows you to sort its data by one or multiple fields in ascending and descending order. When you set the Sortable parameter of the component to true you will be able to click on the header of a column to apply sorting. In the second Grid on this demo, you can see that sorting is enabled for multiple columns. To achieve the same behavior in your own application set the SortMode to Multiple.
This Blazor Data Grid Sorting example is part of a unique collection of hundreds of Blazor demos, with which you can see all Telerik UI for Blazor components and their features in action. View the source code of the demos from the library or directly adapt, and edit them and their theme appearance in Telerik REPL for Blazor or ThemeBuilder.