svghmi/widget_foreach.ysl2
branchsvghmi
changeset 3232 7bdb766c2a4d
parent 3005 ff9ae4f4e3be
child 3241 fe945f1f48b7
equal deleted inserted replaced
3231:5243c2a2f7f8 3232:7bdb766c2a4d
     1 
     1 
     2 template "widget[@type='ForEach']", mode="widget_defs" {
     2 widget_defs("ForEach") {
     3     param "hmi_element";
     3     param "hmi_element";
     4 
     4 
     5     if "count(path) != 1" error > ForEach widget «$hmi_element/@id» must have one HMI path given.
     5     if "count(path) != 1" error > ForEach widget «$hmi_element/@id» must have one HMI path given.
     6     if "count(arg) != 1" error > ForEach widget «$hmi_element/@id» must have one argument given : a class name.
     6     if "count(arg) != 1" error > ForEach widget «$hmi_element/@id» must have one argument given : a class name.
     7 
     7 
    47     |         ]
    47     |         ]
    48     |     },
    48     |     },
    49     |     item_offset: 0,
    49     |     item_offset: 0,
    50 }
    50 }
    51 
    51 
    52 template "widget[@type='ForEach']", mode="widget_class"
    52 widget_class("ForEach")
    53 ||
    53 ||
    54 class ForEachWidget extends Widget{
       
    55 
    54 
    56     unsub_items(){
    55     unsub_items(){
    57         for(let item of this.items){
    56         for(let item of this.items){
    58             for(let widget of item) {
    57             for(let widget of item) {
    59                 widget.unsub();
    58                 widget.unsub();
   115         update_subscriptions();
   114         update_subscriptions();
   116         need_cache_apply.push(this);
   115         need_cache_apply.push(this);
   117         jumps_need_update = true;
   116         jumps_need_update = true;
   118         requestHMIAnimation();
   117         requestHMIAnimation();
   119     }
   118     }
   120 }
       
   121 ||
   119 ||
   122 
   120