We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Attribute rules still empty after setRules()

Hi, my code refresh the query builder every I change the treeView node.
The problem occurrers in thisscenario:

1. In the treeNode A, I create a simple query "Content starts with 'A'"

2. After that, I change the treeNode (with an empty query), so the currentQuery was change to an empty object {}, 

scope.$watch('currentQuery', function (newValue, oldValue) {
if(scope.currentQuery) { // a new node has
} else {

3. The Query Builder update and cleared the last query;

4. After that, I select the first treeNode again that contains a query ('Content start...');

5.  My code detects the changes on currentQuery and update the builder using setRules(scope.currentQuery);

6. The query builder renders my query again, but when I try to edit it, shows an error. 

Basically, the problem occurs when I create a query and save in a variable, clear using setRules({}), load the query with setRules(some query) and try to edit.

8 Replies

VK Vinoth Kumar Sundara Moorthy Syncfusion Team June 24, 2019 11:13 AM UTC

Hi Lucas, 
Good day to you. 
We have checked your requirement “To clear and load rules using setRules() method in QueryBuilder” and it was properly working in our end. For your convenience, we have prepared sample to clear the rule using setRules({}) and load the query using some variable in setRules method, 
Could you please check the above sample and get back to us if we misunderstood your requirement or you need any further assistance on this? 
Vinoth Kumar S 

LU Lucas June 25, 2019 03:03 PM UTC

Hi, unfortunally the problem still continues...

I recorded a video to demonstrate when the problem occurred.

Attachment: Querybuilder_bug_aeb726b9.rar

VK Vinoth Kumar Sundara Moorthy Syncfusion Team June 26, 2019 05:46 PM UTC

Hi Lucas,  
Good day to you. 
We have checked your attached video and please ensure the below steps, 
Step-1: Check the rule collection after adding the condition as demonstrated in the below video link, 
Step-2: After changing the rule, check the changeRule method as demonstrated in below video link, 
Could you please ensure the above steps demonstrated in the video and provide the details? Based on that we will validate and provide you better solution quickly. 
Vinoth Kumar S 

LU Lucas June 26, 2019 07:32 PM UTC

Before Step 1
After load the rules using setRules, the array rules contains different objects, is it normal?