Filter column
If I have a boolean column and set the Type to "Syncfusion.Blazor.Grids.FilterType.Checkbox" have different label names. instead select all, true, and false, to select all, "committed", "uncommitted" because I show the column using the property ShowAsCheckbox. Is this possible? or maybe using column templates?
SIGN IN To post a reply.
1 Reply
1 reply marked as answer
VN
Vignesh Natarajan
Syncfusion Team
January 29, 2021 04:25 AM UTC
Hi Adriana,
Thanks for contacting Syncfusion support.
Query: “instead select all, true, and false, to select all, "committed", "uncommitted" because I show the column using the property ShowAsCheckbox. Is this possible? or maybe using column templates?”
We have analyzed your query and we suggest you to achieve your requirement using FilterItemTemplate feature of the Grid. using FilterItemTemplate, we can customize the contents inside the CheckBox / Excel dialog.
Refer the below code example.
|
<SfGrid DataSource="@Orders" AllowFiltering="true">
<GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.CheckBox"></GridFilterSettings>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>
<GridColumn Field=@nameof(Order.Verified) DisplayAsCheckBox="true" Type="ColumnType.Boolean" HeaderText="Customer Name" Width="150">
<FilterItemTemplate>
@{
var t = (context as FilterItemTemplateContext);
if (t.Value == "True")
{
<div>Committed</div>
}
else if (t.Value == "False")
{
<div>Uncommitted</div>
}
}
</FilterItemTemplate>
</GridColumn>
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
</GridColumns>
</SfGrid>
|
For your convenience we have prepared a sample which can be downloaded from below
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan
Marked as answer
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
- Marked answer
-
AS Adriana Selena Tito Ilasaca
- Jan 28, 2021 08:10 PM UTC
- Jan 29, 2021 04:25 AM UTC