# HG changeset patch # User Edouard Tisserant # Date 1598444874 -7200 # Node ID de4503de2f8c6997e7ce8326b0e77667d740e943 # Parent acecaeadf20d97ad4c6b34ff3330c90810fcb2e3 SVGHMI: JsonTable now updates range and position variables so that slider widget can update. diff -r acecaeadf20d -r de4503de2f8c svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Wed Aug 26 14:24:43 2020 +0200 +++ b/svghmi/gen_index_xhtml.xslt Wed Aug 26 14:27:54 2020 +0200 @@ -1241,7 +1241,7 @@ apply_hmi_value(index, new_val) { - return apply_hmi_value(this.get_variable_index(0), new_val); + return apply_hmi_value(this.get_variable_index(index), new_val); } @@ -3403,7 +3403,9 @@ .then(res => res.json()) - .then(this.spread_json_data); + .then(function(res){console.log(res);return res;}) + + .then(this.spread_json_data.bind(this)); @@ -3694,6 +3696,10 @@ let [range,position,jdata] = janswer; + this.apply_hmi_value(1, range); + + this.apply_hmi_value(2, position); + console.log(range,position,jdata); diff -r acecaeadf20d -r de4503de2f8c svghmi/widget_jsontable.ysl2 --- a/svghmi/widget_jsontable.ysl2 Wed Aug 26 14:24:43 2020 +0200 +++ b/svghmi/widget_jsontable.ysl2 Wed Aug 26 14:27:54 2020 +0200 @@ -19,7 +19,7 @@ fetch(this.args[0], options) .then(res => res.json()) - .then(this.spread_json_data); + .then(this.spread_json_data.bind(this)); } dispatch(value, oldval, index) { @@ -197,6 +197,8 @@ | visible: «count($data_elt/*[@inkscape:label])», | spread_json_data: function(janswer) { | let [range,position,jdata] = janswer; + | this.apply_hmi_value(1, range); + | this.apply_hmi_value(2, position); | console.log(range,position,jdata); apply "$data_elt/*", mode="json_table_render" { with "expressions","$initexpr_ns"; diff -r acecaeadf20d -r de4503de2f8c tests/svghmi/svghmi_0@svghmi/svghmi.svg --- a/tests/svghmi/svghmi_0@svghmi/svghmi.svg Wed Aug 26 14:24:43 2020 +0200 +++ b/tests/svghmi/svghmi_0@svghmi/svghmi.svg Wed Aug 26 14:27:54 2020 +0200 @@ -182,11 +182,11 @@ inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:document-units="px" - inkscape:current-layer="g1887" + inkscape:current-layer="hmi0" showgrid="false" units="px" inkscape:zoom="2.1826319" - inkscape:cx="845.38352" + inkscape:cx="771.61936" inkscape:cy="510.70061" inkscape:window-width="1800" inkscape:window-height="836" @@ -2640,7 +2640,7 @@