Blazor DataGrid Example - Custom Command Buttons
This sample demonstrates the DataGrid with custom command button column.
Employee ID | First Name | Last Name | Hire Date | Country | View Details |
|---|
| 1 | Nancy | Davolio | 1/5/1992 | USA | |
| 2 | Andrew | Fuller | 3/8/1993 | USA | |
| 3 | Janet | Leverling | 11/4/1992 | UK | |
| 4 | Steven | Peacock | 5/5/1992 | USA | |
| 5 | Margaret | Buchanan | 7/5/1993 | UK | |
| 6 | Micheal | Suyama | 8/5/1993 | UK | |
| 7 | Robert | King | 9/5/1993 | USA | |
| 8 | Laura | Callahan | 10/5/1993 | UK | |
| 9 | Anne | Dodsworth | 11/5/1993 | USA |
By setting the Type property of the GridCommandColumn component to None, the Blazor DataGrid Custom command button can be added to the column. The CommandClicked event can be used to capture end-user clicks, and CommandClickEventArgs can be used to access corresponding row details.
In this demo, the following changes had been made in the DataGrid to use a custom command button in a column.
- Added a column named View Details and command button configurations given using
GridCommandColumn. CommandClickedevent is used to capture user clicks.- Used the SfDialog component in viewing the user details.
More information about the Custom command column feature can be found in this documentation section.