Duplicating Composite 100 Times - SOLVED

I want to make a list of parts for my HMI. There should be 8 parts in the array. I saw an example in the composites section with a local script that does this. I tried to replicate it but I'm not getting a result.

Here is the example in the documentation:

https://docs.webiq.de/docs/webiq-designer-manual/#_composite_widgets_how_it_works

This is the local script:

 

 

module.run = function (self) {
        fLog("module ran");
        //Place your Code here
        shmi.onReady({controls:{
            "srcCtrl": ".cartridge"
        }}, (resolved)=> {
            let srcCtrl = resolved.controls.srcCtrl,
            count = 8,
            token = [];
            fLog("hmi ready");
            if (srcCtrl) {
                fLog("found cartridge control");
                var config = srcCtrl.getConfig();
                for (var i = 1; i <= count; i++) {
                    var newConf = shmi.cloneObject(config);
                    newConf.replacers.index = i;
                    let p = srcCtrl.element.parentElement;
                    token.push(shmi.createControl("group", p, newConf, "DIV", null)); // see documentation WebIQ Visuals Reference
                }
            }
            /* called when this local-script is disabled */
            self.onDisable = function () {
                token.forEach(function (control) {
                    shmi.deleteControl(control, true);
                });
                self.run = false; /* from original .onDisable function of LocalScript control */
            };
        });
    };

 

 

I eventually want the count to be flexible.

The last log I can see is "module ran" which shows it's never running onReady. I've attached images of how I have my layout.

Best reply by webiq-sk

Thank you for reporting this issue. We have been able to reproduce it and recorded this with id WEBIQ-3635.
It will be fixed with the next release of WebIQ 2.13 which should be released within the next few weeks.

As a workaround you can rename your cartridgeContainer in such a way that it does not contain the word "catridge" like in the other widget.
It will work if you rename it to e.g. "c_rtidgeContainer" - there is an issue with same names here.

View original
Screenshot 2022-12-12 080353.png
8.95KB
Screenshot 2022-12-12 080421.png
25.3KB
Screenshot 2022-12-12 080449.png
31.82KB
3 replies