Lucas Mikó
Lucas Mikó

Reputation: 82

How to filter by date with Field using Blazor DxDataGridColumn DevExpress?

I'm trying make function the searching when the user fill the Field of date in DxDataGridColumn, as image below:

enter image description here

But the searching don't function.

In razor.cs I maked this:

private ValueDTO valueDTO;

private string importDateValue => this.valueDTO.ImportDate.Value.ToString("dd/MM/yyyy HH:mm:ss");

And in the razor file I uused the code below:

<DxDataGridColumn Caption="@Localizer\["Data de Importação"\]"
                  Field="importDateValue"
                  Width="170px"\>
                  <DisplayTemplate\>
                          @{
                              var item = context as ValueSummaryDTO;
                              if (item?.ImportDate != null && item?.ImportDate.Value != DateTimeOffset.MinValue)
                           {
                              <span\>@item.ImportDate.Value.ToString("dd/MM/yyyy HH:mm:ss")\</span\>
                           }
                           }
                  </DisplayTemplate\>
</DxDataGridColumn\>

But the result of search don't right function. Someone can help me?

Upvotes: 0

Views: 452

Answers (1)

Emerson Silva
Emerson Silva

Reputation: 26

I guess you need to have a property inside your SummaryDTO with the date already converted to string. Then, you can bind the DxDataGridColumn to this property. It should behave as any other text field.

Upvotes: 1

Related Questions