Is it possible to combine 2 Fields sortable and filterbale in one column?
@page "/datagrid/default-functionalities"
@using Syncfusion.Blazor.Grids
@using BlazorDemos
@using blazor_griddata
<div class="col-lg-12 control-section">
<div class="content-wrapper">
<div class="row">
<SfGrid DataSource="@GridData" AllowPaging="true" >
<GridColumns>
<GridColumn Field=@nameof(OrdersDetails.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(OrdersDetails.CustomerID) HeaderText="Customer ID" Width="150"></GridColumn>
<GridColumn Field=@nameof(OrdersDetails.OrderDate) HeaderText="Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
<GridColumn Field=@nameof(OrdersDetails.IsOnSale, OrdersDetails.IsBlackFridayDeal) HeaderText="Sale Information" TextAlign="TextAlign.Right" Width="120"></GridColumn>
</GridColumns>
</SfGrid>
</div>
</div>
</div>
@code{
public List<OrdersDetails> GridData { get; set; }
protected override void OnInitialized()
{
GridData = OrdersDetails.GetAllRecords();
}
}
Hello as per the example above I was thinking about combining 2 or more values in 1 column. Is it something that I could achieve using SfGrid?
as per the image right now that column is not filterable as I am using GridColumn Template.
Hi Pawel
We would like to inform
you that in DataGrid, data operations will be performed based on the field
values i.e.) the data operations like sort, search and filter takes place only
based on the field values.
And template is used only for display purpose. From you shared screenshot, you are trying to perform sort and filter based on the template column value. So it is not feasible to perform sort and filter based on the template column value.
Please let us know if you have any concerns.
Regards,
Naveen Palanivel
Hello Naveen,
I am using a template as it is the only way that I could display those values together.
My main goal is to have those values in 1 row without using a template so I could filter by 2 different fields in one column
I want to be able to filter by
OrdersDetails.IsOnSale, OrdersDetails.IsBlackFridayDeal and display a specific icon for them.
I hope t
Hi Pawel,
We'd like to clarify that filtering two different fields simultaneously is not
supported. The column template is utilized to display customized values.
Therefore, we recommend accessing field values in the context and displaying
values according to your specific requirements. If you have any further
questions or need additional assistance, please feel free to reach out.
Regards,
Sarvesh
- 3 Replies
- 3 Participants
- Marked answer
-
PS Pawel Szpytma
- Jan 25, 2024 01:15 PM UTC
- Feb 7, 2024 03:25 AM UTC