initialize query builder inside for loop

The value for the query builder is not getting set properly if I initialize and set the value inside a for loop. Can you please give me sample code for how to use QB inside a loop ?

Sample Code Snippet:

webix.ready(function () {
                ko.utils.arrayForEach(self.ruleset(), function (rule, index) { -- knockout for loop                     if (self.isInlineEditable && index > 0) {
                        webix.ui({
                            container: "rule-builder-control-" + index,
                            view: "querybuilder",
                            id: "querybuilder" + index,
                            fields: self.webixFields,
                            filters: self.webixOperators(),
                            maxLevel: 3
                        });
                        $$("querybuilder" + index).setValue({
                            glue: rule.ruleJSON.glue,
                            rules: rule.ruleJSON.rules
                        });
                        $$("querybuilder" + index).focus();
                    }
                });
            });

Hello @gnaniyar,

The value for the query builder is not getting set properly if I initialize and set the value inside a for loop.

Unfortunately, I wasn’t able to reproduce the mentioned issue using a standard JS array.

Can you please give me sample code for how to use QB inside a loop ?

Please take a look at the following example: Code Snippet. Essentially, this is the same example as seen in your original post, with the only difference of not using a third-party framework and its API.