Using Syncfusion.blazor 18.4.0.31
I have created a grid which is being provided with data from an SQL select. Two of the columns are DateTime format and I and to use a DateTime calendar component as the filter picker. For example the "Start Time" column should be filtered the selected DateTime with the operator of GreaterThanOrEqual.
Despite trying different formats, every time a filter is applied to the column no records are show. I have experimented by using fabricated DateTime values to filter the column rather than relying on the change value of the picker, but even manually entering a DateTime I can not get any results to display.
The code I am using is below... (I am in the UK and so our DateTime format is dd/MM/yyyy hh:mm:ss)
<SfGrid @ref="Grid" DataSource="@GridData" AllowFiltering="true" AllowPaging="true" AllowSorting="true" AllowResizing="true">
<GridPageSettings PageCount="5"></GridPageSettings>
<GridColumns>
<GridColumn Field=@nameof(CDRmodel.StartTime) HeaderText="Start Time" Width="180" TextAlign="TextAlign.Right" AllowSorting="false" CustomFormat="@(new { type="DateTime", format= "dd/MM/yyyy hh:mm:ss" })">
<FilterTemplate>
<SfDateTimePicker TValue="DateTime?" Placeholder='Select a date and time'>
<DateTimePickerEvents TValue="DateTime?" ValueChange="StartDateChange"></DateTimePickerEvents>
</SfDateTimePicker>
</FilterTemplate>
</GridColumn>
<GridColumn Field=@nameof(CDRmodel.EndTime) HeaderText="End Time" Width="180" TextAlign="TextAlign.Center" AllowSorting="false" CustomFormat="@(new { type="DateTime", format= "dd/MM/yyyy hh:mm:ss" })"> </GridColumn>
<GridColumn Field=@nameof(CDRmodel.OriginationNumber) HeaderText="Origination No." Width="140" AllowSorting="false"></GridColumn>
<GridColumn Field=@nameof(CDRmodel.OriginationName) HeaderText="Origination Name" TextAlign="TextAlign.Right" Width="120" AllowSorting="false"></GridColumn>
<GridColumn Field=@nameof(CDRmodel.CalledNumber) HeaderText="Called No." Width="140" AllowSorting="false"></GridColumn>
<GridColumn Field=@nameof(CDRmodel.CalledName) HeaderText="Called Name" TextAlign="TextAlign.Right" Width="120" AllowSorting="false"></GridColumn>
</GridColumns>
</SfGrid>
@code{
public void StartDateChange(ChangedEventArgs<DateTime?> args)
{
Grid.FilterByColumn("StartTime", "GreaterThanOrEqual", args.Value);
}
}
Using the custom format on the field appears to make no difference.
I have searched long and hard and cannot find any solution to this, so any help would be appreciated.
Thanks in advance - Martin