cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Duplicating Composite 100 Times - SOLVED

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.

3 REPLIES 3

webiq-eg
Long-established Member

Hi,

the exact code with copy/paste run on my computer. Can you send the entire HMI project that I can check it?

Kinde regards

webiq-eg

webiq-sk
Frequent Contributor

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.

Thanks! This fix wasn't working at first but maybe the site was cacheing something because it is working now!

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist