Hello,
I created a repl to replicate the issue that I'm having. I created a Filter with a custom editor. For this example, I used a Textbox and I save the changes back to the context.FilterDescriptor.Value in the OnChange method which occurs when the user blurs focus.
If you start the repl w/o checking the Use Custom Editor checkbox and enter text where the "Sample" value is located you will see the changes are saved properly to the bound CompositeFilter property and are echo'd back in the screen.
If instead you check the Use Custom Editor box and perform the same test you'll see that the same changes are not present in the bound CompositeFilter.
Note that this issue only occurs if you start with an existing CompositeFilter and bind it to the filter control. It seems that if the control creates the FilterDescriptor objects then their changes bind properly, but if the FilterDescriptor objects existed before binding to the control then the issue occurs.
https://blazorrepl.telerik.com/wIOtcKOb31mjTc3351
Thank You,
-Andy
============= TELERIK EDIT ===============
A possible workaround is to find the original filter descriptor and update its Value:
@using Telerik.DataSource
@System.Text.Json.JsonSerializer.Serialize(FilterValue)
<br />
<br />
<TelerikFilter @bind-Value="@FilterValue">
<FilterFields>
<FilterField Name="Field" Type="@(typeof(string))">
<ValueTemplate>
<TelerikTextBox Value="@((string)context.FilterDescriptor.Value)"
ValueChanged="@( (string newValue) => OnTextBoxValueChanged(context.FilterDescriptor, newValue) )"
DebounceDelay="0" />
</ValueTemplate>
</FilterField>
</FilterFields>
</TelerikFilter>
@code {
private void OnTextBoxValueChanged(FilterDescriptor templateFD, string newValue)
{
var originalFD = FilterValue.FilterDescriptors.OfType<FilterDescriptor>().FirstOrDefault(x =>
{
return x.Member == templateFD.Member &&
x.MemberType == templateFD.MemberType &&
x.Operator == templateFD.Operator &&
x.Value == templateFD.Value;
});
if (originalFD != null)
{
templateFD.Value = newValue;
originalFD.Value = newValue;
}
}
private CompositeFilterDescriptor FilterValue { get; set; } = new()
{
LogicalOperator = FilterCompositionLogicalOperator.Or,
FilterDescriptors = new FilterDescriptorCollection() {
new FilterDescriptor()
{
Member = "Field",
MemberType = typeof(string),
Value = "Sample"
}
}
};
}
Please expose a refresh/rebind method for the Filter. I want to force refresh the component when programmatically changing its value during runtime.
===
ADMIN EDIT
===
A possible workaround for the time being is to dispose the component and reinitialize it again after programmatically changing the value. Here is an example: https://blazorrepl.telerik.com/GnkgQPPU37sHWkak55.
When I change the field from the dropdown to another field of the same type, the filter editor is not updated.
The issue occurs when I'm using Enum fields - the dropdown editor is not updated to display the correct values of the newly selected Enum field.
Reproduction: https://blazorrepl.telerik.com/QHExPalR55jvaD1t12.
Steps to reproduce:
Steps to reproduce:
If the CompositeFilterDescriptor is set with a predefined filter before the filter component is rendered on the page it locks up the UI.
I've noticed this issue if the Filter is user under a TabStrip.. You set the filter and navigate way from the tab and back it will lock up.