Filter throws exception when combined with GridForeignColumn

Hello,

I have a grid which references another table in order to get a status name instead of an id number.  AllowFiltering is allowed in the grid.

<GridFilterSettings Type ="Syncfusion.Blazor.Grids.FilterType.Menu"></GridFilterSettings>
<GridColumns>
<GridColumn Field=@nameof(LoyaltyCards.Id) HeaderText="Id" IsPrimaryKey="true" IsIdentity="true" AllowEditing="false" Visible="false" ShowInColumnChooser="false"></GridColumn>
<GridColumn Field=@nameof(LoyaltyCards.CardNumber) HeaderText="Número" Visible="true" AutoFit="true"></GridColumn>
<GridForeignColumn Field=@nameof(LoyaltyCards.CardStatus) HeaderText="Estado" TValue="CardStatus" ForeignKeyField="Id" ForeignKeyValue="Status" AutoFit="true">
<SfDataManager Url=@($"{apiURL}/cardstatus") Adaptor="Adaptors.ODataV4Adaptor" CrossDomain="true"></SfDataManager>
</GridForeignColumn>
<GridColumn Field=@nameof(LoyaltyCards.CardIssueDate) HeaderText="Fecha Emisión" AllowFiltering="true" Visible="true" Format="d" Type="ColumnType.Date" AutoFit="true"></GridColumn>
</GridColumns>

I like ForeignColumn because it allows to filter by the referenced named instead of the Id.

I was using the standard filtering (by writing on the textbox) but it does not work on date fields. Is there any way to filter by date?

To allow search dates, I added the Type FilterType.Menu. However it throws an exception after clearing the filter of the ForeignColumn (setting the filter works ok, but clearing it generates the issue).


warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
      Unhandled exception rendering component: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.updateValues(Dictionary`2 props)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.initValue(Dictionary`2 props)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.InitialRendered()
   at Syncfusion.Blazor.BaseComponent.InitComponent()
   at Syncfusion.Blazor.BaseComponent.OnAfterRenderAsync(Boolean firstRender)
   at Syncfusion.Blazor.DropDowns.DropDownBase`1.OnAfterRenderAsync(Boolean firstRender)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.OnHybridAfterRender(Boolean firstRender)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.OnAfterRenderAsync(Boolean firstRender)
   at Syncfusion.Blazor.DropDowns.SfAutoComplete`2.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
      Unhandled exception in circuit '8BTgRQ-9vq01u-EQn8SGzoh77b509eVEgE8HXmESDx0'.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.updateValues(Dictionary`2 props)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.initValue(Dictionary`2 props)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.InitialRendered()
   at Syncfusion.Blazor.BaseComponent.InitComponent()
   at Syncfusion.Blazor.BaseComponent.OnAfterRenderAsync(Boolean firstRender)
   at Syncfusion.Blazor.DropDowns.DropDownBase`1.OnAfterRenderAsync(Boolean firstRender)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.OnHybridAfterRender(Boolean firstRender)
   at Syncfusion.Blazor.DropDowns.SfDropDownList`2.OnAfterRenderAsync(Boolean firstRender)
   at Syncfusion.Blazor.DropDowns.SfAutoComplete`2.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
      Unhandled exception in circuit '8BTgRQ-9vq01u-EQn8SGzoh77b509eVEgE8HXmESDx0'.
System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation[T](String identifier, Object[] args)
   at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
   at Syncfusion.Blazor.SfBaseComponent.InvokeMethod(String methodName, Object[] methodParams)
   at Syncfusion.Blazor.Popups.SfDialog.ComponentDispose()
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_0(Object state)
   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteSynchronously(TaskCompletionSource`1 completion, SendOrPostCallback d, Object state)
   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<.cctor>b__23_0(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.ExecuteBackground(WorkItem item)


I'm using v18.2.0.48 and the Grid uses OData.

Thanks,

Erick



1 Reply 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team August 10, 2020 01:20 PM UTC

Hi Erick, 

Greetings from Syncfusion support. 

Query 1 : However it throws an exception after clearing the filter of the ForeignColumn (setting the filter works ok, but clearing it generates the issue). 
We have confirmed it as a bug and logged the defect report “Exception occurs when opening the Filter Menu dialog second time after filtering ForeignKeyColumn” for the same. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle) and including the defect fix in our upcoming Bi-weekly release which is expected to be rolled by the mid of September, 2020.   
  
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link. 
 
Query 2 : I was using the standard filtering (by writing on the textbox) but it does not work on date fields. Is there any way to filter by date? 
We tried to reproduce the reported problem by creating a sample with the codes from below documentation, but the filtering for Date column works fine with FilterBar in Grid. 

We are attaching the sample for your reference, please download the sample from the link below, 

And if you are still facing difficulties, kindly get bac to us with the following details for better assistance. 
  1. Share the sample which you have tried from your side. Or reproduce the problem with the attached sample and share with us for further analysis.
  2. Share the video demo showing the problem you are facing.
  3. Share the details of any exception you have faced when filtering the date column value.
  4. Share the exact scenario or proper replication procedure.
  5. Share your complete model class codes(LoyaltyCards, CardStatus). And also share a example of Date column(CardIssueDate) values you will be having in Grid.

The provided information will help us analyze the problem, and provide you a solution as early as possible. 

Regards, 
Renjith Singh Rajendran 


Marked as answer
Loader.
Up arrow icon