FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
12-12-2022 04:06 PM - edited 12-13-2022 04:29 PM
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.
Solved! Go to Solution.
12-13-2022 09:03 AM
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
12-13-2022 09:22 AM
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.
12-13-2022 04:29 PM
Thanks! This fix wasn't working at first but maybe the site was cacheing something because it is working now!