Bug with Grid's PredicateModel detection

Hello!
Next bug:
The grid incorrectly determines the predicatemodel if you switch between filters without closing the previous popup filter.
Click on the date column filter icon, then without closing the filter click on the integer column filter icon.
The predicatemodel's type is still datetime but not integer as expected.
Therefore, it is impossible to bind to the predicatemodel value as runtime errors occur

<SfGrid TValue="Order" AllowFiltering="true">
    <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu" ShowFilterBarStatus="true" />
    <GridColumns>
        <GridColumn Field="@nameof(Order.Id)">
            <FilterTemplate>
                @{
                    GetPredicateType(context);
                }
            </FilterTemplate>
        </GridColumn>
        <GridColumn Field="@nameof(Order.Date)">
            <FilterTemplate>
                @{
                    GetPredicateType(context);
                }
            </FilterTemplate>
            </GridColumn>
    </GridColumns>
</SfGrid>


@code{
    private void GetPredicateType(object obj)
    {
        Debug.WriteLine(obj.GetType());
    }

    public class Order
    {
        public int Id { get; set; }
        public DateTime? Date { get; set; }
    }
}

3 Replies 1 reply marked as answer

VN Vignesh Natarajan Syncfusion Team September 28, 2020 01:52 PM UTC

Hi Ivan, 
 
Thanks for contacting Syncfusion support. 
 
Query: “The grid incorrectly determines the predicatemodel if you switch between filters without closing the previous popup filter. 
 
We have analyzed your query by preparing a sample using your code example. We are not able to reproduce the reported issue at our end. Please find the sample which we prepared using your code example from below  
 
 
After referring the sample, if you are still facing the issue. Kindly get back to us with following details.  
 
  1. Share your full Grid code example.
  2. Share the video demonstration of the issue along with replication procedure.
  3. If possible try to reproduce the reported issue in provided sample and revert back to us.
 
Above requested query will be helpful for us to validate the reported query at our end and provide solution as early as possible.   
 
Regards, 
Vignesh Natarajan  
 



IV Ivan September 28, 2020 08:46 PM UTC

You probably reproduced the bug incorrectly. It is also present in your example.
I am attaching a video and your example

Attachment: Screen_Recording_(28.09.2020_234145)_9370d70.rar


VN Vignesh Natarajan Syncfusion Team September 29, 2020 08:44 AM UTC

Hi Ivan,  
 
Thanks for explaining the reported issue with video demo. 
 
Query: “You probably reproduced the bug incorrectly. It is also present in your example. 
 
We have validated the reported issue and we are able to reproduce the reported issue at our end in the provided sample. We have considered it as a bug and logged the defect report for the same “FilterTemplate Context value returns same type for different columns of different datatype”. Thank you for taking the time to report this issue and helping us improve our product. Fix for the issue will be included in our weekly patch release which is expected to be rolled out by mid of October, 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.      
 
 
Once the above issue is resolved, kindly define the context of FilterTemplate like below (i.e.) type cast the PredicateModel based on column type 
 
<SfGrid TValue="Order" DataSource="Orders" AllowFiltering="true"> 
    <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu" /> 
    <GridColumns> 
        <GridColumn Field="@nameof(Order.Id)"> 
            <FilterTemplate> 
                @{ 
                    GetPredicateType("integer", (context as PredicateModel<int>)); 
                } 
            </FilterTemplate> 
        </GridColumn> 
        <GridColumn Field="@nameof(Order.Date)"> 
            <FilterTemplate> 
                @{ 
                    GetPredicateType("DateTime"(context as PredicateModel<DateTime?>)); 
                } 
            </FilterTemplate> 
        </GridColumn> 
    </GridColumns> 
</SfGrid> 
  
  
@code{ 
    private void GetPredicateType(string caller, object obj) 
    { 
        Debug.WriteLine($"caller: {caller} - {obj?.GetType()}"); 
    } 
 
 
Till then we appreciate your patience.   
 
Regards, 
Vignesh Natarajan 


Marked as answer
Loader.
Up arrow icon