I use a custom filter row for the Grid where I have added a custom component holding the filter cell content. I am saving the Grid state upon change and restoring it on initialization.
I noticed that the custom filter component is initialized before the Grid state. As a result, there is an applied filter but the input in the custom filter component does not show it.
This behaviour was new since version 6.0.0. With 5.1.1 it doesn't appear.
Hi Rayko,
During an additional revision of this item with the development team, we've confirmed that the reported behavior is not a bug with the component but an expected functioning. Let me provide more details.
The issue occurs when one is using a custom component inside the FilterTemplate and setting the filter value in the custom component when it initializes. Based on how the framework operates, this custom component inside the FilterTemplate will be initialized first before the Grid. The Grid then initializes and sets the filtered state but the custom component in the FilterTemplate is not refreshed to show the new value.
To refresh it in this case, we will need to re-render the whole Grid which will have non-desired performance implications. The behavior has changed after 5.1.1 due to performance optimizations in the Grid striving to not rerender it when not needed.
The recommended approach is to set the filter value upon parameters set and not when the custom component in the FilterTemplate initializes.
So, in the CustomTextRowFilter component inside the FilterTemplate, instead of overriding the OnInitializedAsync to set the filters:
protected override Task OnInitializedAsync()
{
Field = ((FilterDescriptor)Context.FilterDescriptor.FilterDescriptors[0])?.Member;
SetValue(((FilterDescriptor)Context.FilterDescriptor.FilterDescriptors[0]).Value);
SetOperator();
return base.OnInitializedAsync();
}
set them in OnParametersSetAsync:
protected override Task OnParametersSetAsync()
{
Field = ((FilterDescriptor)Context.FilterDescriptor.FilterDescriptors[0])?.Member;
SetValue(((FilterDescriptor)Context.FilterDescriptor.FilterDescriptors[0]).Value);
SetOperator();
return base.OnParametersSetAsync();
}
Having the above in mind, I am hereby marking the item as "Won't Fix" as the described behavior is expected.
Regards,
Nadezhda Tacheva
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.