1 // widget_jsontable.ysl2 |
1 // widget_jsontable.ysl2 |
2 |
2 |
3 template "widget[@type='JsonTable']", mode="widget_class" |
3 template "widget[@type='JsonTable']", mode="widget_class" |
4 || |
4 || |
5 class JsonTableWidget extends Widget{ |
5 class JsonTableWidget extends Widget{ |
6 cache = []; |
6 cache = [100,50]; |
7 do_http_request(...opt) { |
7 do_http_request(...opt) { |
8 const query = { |
8 const query = { |
9 args: this.args, |
9 args: this.args, |
10 vars: this.cache, |
10 range: this.cache[1], |
|
11 position: this.cache[2], |
11 visible: this.visible, |
12 visible: this.visible, |
12 options: opt |
13 options: opt |
13 }; |
14 }; |
14 |
15 |
15 const options = { |
16 const options = { |
216 | visible: «count($data_elt/*[@inkscape:label])», |
217 | visible: «count($data_elt/*[@inkscape:label])», |
217 | spread_json_data: function(janswer) { |
218 | spread_json_data: function(janswer) { |
218 | let [range,position,jdata] = janswer; |
219 | let [range,position,jdata] = janswer; |
219 | this.apply_hmi_value(1, range); |
220 | this.apply_hmi_value(1, range); |
220 | this.apply_hmi_value(2, position); |
221 | this.apply_hmi_value(2, position); |
|
222 | this.apply_hmi_value(3, this.visible); |
221 | console.log(range,position,jdata); |
223 | console.log(range,position,jdata); |
222 apply "$data_elt", mode="json_table_render_except_comments" { |
224 apply "$data_elt", mode="json_table_render_except_comments" { |
223 with "expressions","$initexpr_ns"; |
225 with "expressions","$initexpr_ns"; |
224 with "widget_elts","$hmi_element/*[@inkscape:label = 'data']/descendant::svg:*"; |
226 with "widget_elts","$hmi_element/*[@inkscape:label = 'data']/descendant::svg:*"; |
225 } |
227 } |