Hi,
I wonder if it is possible to select date intervals on a date picker? I want to select the 15,16,17,18 of March on the picker.
Hi @Robot,
Multiple selection is not supported by the DatePicker component.
Do you have this feature on your roadmap? @enchev
@Robot No, however it might be added with external pull request.
I found Blazorise DatePicker for multiple date selections. Is there a way to make the DataFilter filter based on multiple dates?
Sample code:
<RadzenDataFilter @ref="dataFilter" Auto="auto" Data="@_orders" TItem="ReportViewModel" ViewChanged="@(view => filteredOrders = view.ToList())"
FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive">
<Properties>
<MyCustomDataFilterProperty TItem="ReportViewModel" Property="OrderDateTime" Title="Order Date" FormatString="{0:d}" FilterValue="@selectedDates">
<FilterTemplate>
<DatePicker @bind-Dates="selectedDates" TValue="DateTime?" InputMode="DateInputMode.Date" SelectionMode="DateInputSelectionMode.Multiple" />
</FilterTemplate>
</MyCustomDataFilterProperty>
</Properties>
</RadzenDataFilter>
@code {
IReadOnlyList<DateTime?> selectedDates;
IEnumerable<ReportViewModel> _orders;
IEnumerable<ReportViewModel> filteredOrders;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await base.OnAfterRenderAsync(firstRender);
if (firstRender)
{
if (DataLoading)
{
return;
}
try
{
DataLoading = true;
_orders = await GetOrdersExportUseCase.ExecuteAsync();
filteredOrders = _orders.ToList();
}catch (Exception e)
{
_logger.LogError(e.Message);
Console.WriteLine(e);
}
finally
{
DataLoading = false;
}
}
}
}
I am getting this error; How can I fix this? Should I use FilterOperator.Contains for this?
Thank you.
Both demos of the DataFilter component shows how to filter IEnumerable:
What I want is a different situation from your demos @enchev. I am selecting multiple dates but I can not filter with the Data filter. I think there is no contains filter for Date Time. I will be glad if you can provide a solution.
Hey @Robot,
I strongly suggest you to check our demos again. The DataFilter component can filter generic IEnumerable no matter of int, string or DateTime.