I have a simple RadzenGrid on a Blazor Project that is populated by a List (Model). There is a DateTime Column (AuditDate). Users want to see this as full datetime, but filter on date only. Is that possible?
I found a partial example online, and trying to make that work in my own app, but not having enough experience and knowledge to make it work for me.
List<View_CatAudit> catAuditList;
catAuditList = oCATAuditRepository.GetAll();
public List<View_CatAudit> GetAll()
{
return Context.View_CatAudits.ToList();
}
RadzenGrid
<RadzenDataGrid AllowFiltering="true" AllowColumnResize="true" FilterMode="FilterMode.Simple" AllowSorting="true" PageSize="10" AllowPaging="true" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true"
Data="@catAuditList" TItem="View_CatAudit" SelectionMode="DataGridSelectionMode.Single" @bind-Value=@selectedRequest ColumnWidth="300px" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" LogicalFilterOperator="LogicalFilterOperator.And" AllowColumnPicking="true">
<Columns>
<RadzenDataGridColumn TItem="View_CatAudit" Property="RecordID" Title="" Width="50px" >
<Template Context="data">
<RadzenButton Icon="search" Size="ButtonSize.Small" ButtonStyle="ButtonStyle.Secondary" Click=@(() => GoToSelected(data.FK_CATRecordID)) />
</Template>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="View_CatAudit" Property="AuditDate" Title="Date" Width="120px" />
Here is where I (believe) that I need a Custom Filter Template - and where I get lost.
I found a sample online and I think I am on the right path . . . but have some questions.
The example I found (which is incomplete) adds a "FilterValue" to the Column
<RadzenDataGridColumn TItem="View_CatAudit" Property="AuditDate" Title="Date" Width="120px" FilterValue="@FilteredAuditDate" />
I am not sure what this is doing and where the @FilteredAuditDate should come from? The code is not shown in sample.
Custom Filter:
<FilterTemplate>
<RadzenDatePicker @bind-Value="@selectedRequest" DateFormat="d" Change="@(args => DateFilterChange (args, "AuditDate", "MM/dd/yyyy"))" />
</FilterTemplate>
The code for 'DateFilterChange is not shown, in the example, and I don't know what that is doing.