svghmi/widget_jsontable.ysl2
changeset 3386 608f48ad3dfc
parent 3352 3a138ccdfafa
equal deleted inserted replaced
3385:18621ce81f5f 3386:608f48ad3dfc
     4     longdesc
     4     longdesc
     5     || 
     5     || 
     6     Send given variables as POST to http URL argument, spread returned JSON in
     6     Send given variables as POST to http URL argument, spread returned JSON in
     7     SVG sub-elements of "data" labeled element.
     7     SVG sub-elements of "data" labeled element.
     8     
     8     
     9     Documentation to be written. see svbghmi exemple.
     9     Documentation to be written. see svghmi exemple.
    10     ||
    10     ||
    11 
    11 
    12     shortdesc > Http POST variables, spread JSON back
    12     shortdesc > Http POST variables, spread JSON back
    13 
    13 
    14     arg name="url" accepts="string" >  
    14     arg name="url" accepts="string" >  
   149 const "initexpr" expression attrib "content" > jdata
   149 const "initexpr" expression attrib "content" > jdata
   150 const "initexpr_ns", "exsl:node-set($initexpr)";
   150 const "initexpr_ns", "exsl:node-set($initexpr)";
   151 
   151 
   152 template "svg:use", mode="json_table_elt_render" {
   152 template "svg:use", mode="json_table_elt_render" {
   153     param "expressions";
   153     param "expressions";
   154     // cloned element must be part of a HMI:List
   154     // cloned element must be part of a HMI:List or a HMI:List
   155     const "targetid", "substring-after(@xlink:href,'#')";
   155     const "targetid", "substring-after(@xlink:href,'#')";
   156     const "from_list", "$hmi_lists[(@id | */@id) = $targetid]";
   156     const "from_list", "$hmi_lists[(@id | */@id) = $targetid]";
   157 
   157 
   158     choose {
   158     choose {
   159         when "count($from_list) > 0" {
   159         when "count($from_list) > 0" {
   160             |         id("«@id»").setAttribute("xlink:href",
   160             |         id("«@id»").href.baseVal =
   161             // obtain new target id from HMI:List widget
   161             // obtain new target id from HMI:List widget
   162             |             "#"+hmi_widgets["«$from_list/@id»"].items[«$expressions/expression[1]/@content»]);
   162             |             "#"+hmi_widgets["«$from_list/@id»"].items[«$expressions/expression[1]/@content»];
   163         }
   163         }
   164         otherwise
   164         otherwise
   165             warning > Clones (svg:use) in JsonTable Widget must point to a valid HMI:List widget or item. Reference "«@xlink:href»" is not valid and will not be updated.
   165             warning > Clones (svg:use) in JsonTable Widget must point to a valid HMI:List widget or item. Reference "«@xlink:href»" is not valid and will not be updated.
   166     }
   166     }
   167 }
   167 }