equal
deleted
inserted
replaced
1 // widget_jsontable.ysl2 |
1 // widget_jsontable.ysl2 |
2 |
2 |
3 template "widget[@type='JsonTable']", mode="widget_class" |
3 widget_class("JsonTable") |
4 || |
4 || |
5 class JsonTableWidget extends Widget{ |
|
6 // arbitrary defaults to avoid missing entries in query |
5 // arbitrary defaults to avoid missing entries in query |
7 cache = [0,0,0]; |
6 cache = [0,0,0]; |
8 init_common() { |
7 init_common() { |
9 this.spread_json_data_bound = this.spread_json_data.bind(this); |
8 this.spread_json_data_bound = this.spread_json_data.bind(this); |
10 this.handle_http_response_bound = this.handle_http_response.bind(this); |
9 this.handle_http_response_bound = this.handle_http_response.bind(this); |
81 } |
80 } |
82 } |
81 } |
83 // on_click(evt, ...options) { |
82 // on_click(evt, ...options) { |
84 // this.do_http_request(...options); |
83 // this.do_http_request(...options); |
85 // } |
84 // } |
86 } |
|
87 || |
85 || |
|
86 |
|
87 gen_index_xhtml { |
88 |
88 |
89 template "svg:*", mode="json_table_elt_render" { |
89 template "svg:*", mode="json_table_elt_render" { |
90 error > JsonTable Widget can't contain element of type «local-name()». |
90 error > JsonTable Widget can't contain element of type «local-name()». |
91 } |
91 } |
92 |
92 |
257 | } catch(err) { |
257 | } catch(err) { |
258 | id("«@id»").style = "display:none"; |
258 | id("«@id»").style = "display:none"; |
259 | } |
259 | } |
260 } |
260 } |
261 |
261 |
262 template "widget[@type='JsonTable']", mode="widget_defs" { |
262 } |
|
263 |
|
264 widget_defs("JsonTable") { |
263 param "hmi_element"; |
265 param "hmi_element"; |
264 labels("data"); |
266 labels("data"); |
265 const "data_elt", "$result_svg_ns//*[@id = $hmi_element/@id]/*[@inkscape:label = 'data']"; |
267 const "data_elt", "$result_svg_ns//*[@id = $hmi_element/@id]/*[@inkscape:label = 'data']"; |
266 | visible: «count($data_elt/*[@inkscape:label])», |
268 | visible: «count($data_elt/*[@inkscape:label])», |
267 | spread_json_data: function(janswer) { |
269 | spread_json_data: function(janswer) { |