Query Builder - Error when loading rules from sql string if query builder is in a non-focused tab

Hello,

We are using the query builder within a component that is housed within a mat-tab-group. There are two tabs, the Settings tab (which contains other fields and data), and the Rules tab, which is where the component that contains the query builder is located. Upon loading these tabs, the Settings tab is focused, so the query builder does not get rendered in the html.

However, the criteria-builder component is loading regardless of whether that tab is focused or not, so on initial load, it attempts a setRulesFromSql using an input sql query string. That is when we get this error:

Image_8575_1698081296736

It seems like the issue here is that it tries to do dropdownTree.element for the field dropdown when setting the query, but the element is null, so it throws this error and the query builder does not load properly. When I switch over to the tab that contains the query builder, this is what I see:

Image_3613_1698081670509

The query I was attempting was a simple one, like "(NameField = 'test')".

Is there something we can do to ensure it gets set up properly when using the setRulesFromSql method if it is on a non-focused tab?

Thank you,

KS


1 Reply

KV Keerthikaran Venkatachalam Syncfusion Team November 9, 2023 05:00 PM UTC

Hi KS,


We have checked your reported query, and we suspect that you have set the same ID for both QueryBuilder. To resolve this issue, please set individual IDs for each QueryBuilder. Please refer to the below video demonstration and sample.


Sample link: https://stackblitz.com/edit/angular-p5ujsz-hkpew4?file=src%2Fapp.component.ts


If you still facing issue, could you please replicate the issue in our sample with replication steps and a video demonstration? Based on that, we will check and provide you with a better solution quickly


Regards,

KeerthiKaran K V


Attachment: screencapture_(1)_720d1fca.zip

Loader.
Up arrow icon