This solution provided in this forum post
https://www.syncfusion.com/forums/171587/bug-in-query-builder
does not work if you upgrade syncfusion to 20.3.61. When you select AND/OR from the dropdown it stays at the original selection.
Hi Hakop,
We have checked your reported query and kindly refer to the below code snippet to resolve this issue.
<HeaderTemplate> @{ @if (condition == null) { condition = (string)context.Condition; } } <SfDropDownList ID="@context.ID" @bind-Value="@condition" TValue="string" TItem="Condition" CssClass="e-outline" Width="100px" DataSource="@ConditionsList"> ….. private string condition; … private void conditionChange(ChangeEventArgs<string, Condition> args, HeaderTemplateModel model) { if (args.IsInteracted) { model.Condition = args.Value.ToLower(); condition = args.Value; } } |
And please refer to the below UG link for how condition value changes properly in header template using the Created event instead Value property of dropdown list component.
UG link: https://blazor.syncfusion.com/documentation/query-builder/templates#header-template
Check with attached sample code file and get back to us if you need any further assistance on this.
Regards,
YuvanShankar A
Is this the recommended way of handling this type of change? A global variable changes all the conditions on the querybuilder.
I had to do something like this to get the Condition to update:
string groupString = model.ID.Replace("querybuilder_group", "");
Int32.TryParse(groupString, out group);
QueryBuilderObj.GetRules().Rules[group].Condition = args.Value.ToLower();
Unfortunately it does not work for the top level group condition, that Condition always reverts back to the starting condition.
Hakop,
Sorry for the delay. We have checked your reported query and kindly refer to the below code snippet and attached sample file. Using the Created event of dropdown list component, we can assign the value to dropdown list through Value property as shown as below.
UG link: https://blazor.syncfusion.com/documentation/query-builder/templates#header-template
<HeaderTemplate> <SfDropDownList ID="@context.ID" TValue="string" TItem="Condition" CssClass="e-outline" Width="100px" DataSource="@ConditionsList" @ref="ddlObj"> <DropDownListFieldSettings Text="Text" Value="Value"></DropDownListFieldSettings> <DropDownListEvents TValue="string" TItem="Condition" Created="e => ddlCreated(e, context)" ValueChange="e => conditionChange(e, context)"></DropDownListEvents> </SfDropDownList> ….. SfDropDownList<string, Condition> ddlObj { set { ddlRefs.Add(value); } } List<SfDropDownList<string, Condition>> ddlRefs = new List<SfDropDownList<string, Condition>>(); … private void ddlCreated(Object obj, HeaderTemplateModel model) { foreach (SfDropDownList<string, Condition> ddlObj in ddlRefs) { if (ddlObj.ID == model.ID) { ddlObj.Value = model.Condition.ToLower(); } } } |
Check with attached sample code file and get back to us if you need any further assistance on this.
this solution does not appear to set the values in the RuleSet which is really what we need
If u look here, everything is unchanged.
QueryBuilderObj.GetRules()
So when i save the data values are incorrect. Am i missing something?
Sorry for the delay, Hakop.
We have confirmed the issue as “Condition value not update properly in Query builder ruleset while using header template" and logged a defect report. We will include the fix for this issue in upcoming weekly patch release scheduled for mid of April 2023.
Feedback link: https://www.syncfusion.com/feedback/42621/condition-value-not-update-properly-in-query-builder-ruleset-while-using-header
You will be informed regarding this once the fix is published.
Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”
thanks, however we will be developing our own version of this component to better fit our needs.
Okay, Hakop. If any assistance is needed for Syncfusion controls, please get back to us. The promised fix will be available publicly, and you can use it if needed.
Hi Hakop,
We are glad to announce our weekly patch release (21.1.41) is rolled out. We have included the fix for this “Condition value not update properly in Query builder ruleset while using header template” issue in this release. So, we suggest you upgrade our Syncfusion packages to our latest version to resolve this issue in your end (21.1.41).
Feedback link: https://www.syncfusion.com/feedback/42621/condition-value-not-update-properly-in-query-builder-ruleset-while-using-header
Release notes: https://blazor.syncfusion.com/documentation/release-notes/21.1.41?type=all#querybuilder
Regards,
YuvanShankar A