|
<SfGrid DataSource="@Orders" AllowPaging="true" Height="315">
<GridEvents CommandClicked="OnCommandClicked" TValue="Order"></GridEvents>
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" EditType="EditType.DatePickerEdit" Format="d" TextAlign="TextAlign.Right" Width="130"></GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn HeaderText="Manage Records" Width="150">
<GridCommandColumns>
<GridCommandColumn ButtonOption="@(new CommandButtonOptions() { Content = "Details", IconCss = "e-icons e-add", CssClass = "e-flat" })"></GridCommandColumn>
</GridCommandColumns>
</GridColumn>
</GridColumns>
</SfGrid> |
|
|
has this been resolved? can I use my own custom icon since the button is used for a different action and I need to maintain the design principals
Hi
lan Burt,
Yes, you can use your own custom icon in the DataGrid. To customize the
button's icon, you can use the template feature. This allows you to define your
own html and include custom icons as per your design requirements. Kindly refer
to the below code snippet and sample for your reference.
|
<GridColumn HeaderText="Actions" Width="150" > <Template> @{ var data = context as OrderData; <button class="custom-icon" @onclick="@(args => CustomAction(data))"></button>
} </Template> </GridColumn> |
Sample:
https://blazorplayground.syncfusion.com/embed/BjLpZmWXKGWhCXly?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5
Reference: https://blazor.syncfusion.com/documentation/datagrid/column-template
Additionally, you can use the custom command column to customize the button
based on your requirements. Kindly refer to the documentation below for more
details.
https://blazor.syncfusion.com/documentation/datagrid/command-column-editing
Regards,
Prathap Senthil