diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-01-23 11:00:02 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-01-23 11:00:02 +0100 |
commit | 201d711a1d3dfbe46d622871731005937598e790 (patch) | |
tree | e43a95ee027e1be6ca8621f9e2c78aaf932a3421 /python/gui/static/js/odr-rcvalues.js | |
parent | 674228bedb325384f12602350ab36d075b5509a3 (diff) | |
parent | e0abfc3728fb56519fa2507d2468214e2a633c98 (diff) | |
download | dabmod-201d711a1d3dfbe46d622871731005937598e790.tar.gz dabmod-201d711a1d3dfbe46d622871731005937598e790.tar.bz2 dabmod-201d711a1d3dfbe46d622871731005937598e790.zip |
Merge branch 'next' into lime
Diffstat (limited to 'python/gui/static/js/odr-rcvalues.js')
-rw-r--r-- | python/gui/static/js/odr-rcvalues.js | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/python/gui/static/js/odr-rcvalues.js b/python/gui/static/js/odr-rcvalues.js index f49674c..486a8a7 100644 --- a/python/gui/static/js/odr-rcvalues.js +++ b/python/gui/static/js/odr-rcvalues.js @@ -31,22 +31,28 @@ function requestStatus() { doApiRequestGET("/api/rc_parameters", function(data) { console.log(data); - let keys = Object.keys(data); - keys.sort(); + let controllable_names = Object.keys(data); + controllable_names.sort(); var key1; - for (key1 in keys) { - let keys2 = Object.keys(data[keys[key1]]); - keys2.sort(); + for (key1 in controllable_names) { + let param_names = Object.keys(data[controllable_names[key1]]); + param_names.sort(); var key2; - for (key2 in keys2) { - var param = data[keys[key1]][keys2[key2]]; - var key = keys[key1] + "_" + keys2[key2]; + for (key2 in param_names) { + var name_controllable = controllable_names[key1]; + var name_param = param_names[key2]; + var key = name_controllable + "_" + name_param; + + var param = data[name_controllable][name_param]; var valueentry = '<input type="text" id="input'+key+'" ' + 'value="' + param['value'] + '">' + '<button type="button" class="btn btn-xs btn-warning"' + - 'id="button'+key+'" >upd</button>'; + 'id="button'+key+'" ' + + 'data-controllable="'+name_controllable+'" ' + + 'data-param="'+name_param+'" ' + + '>upd</button>'; $('#rctable > tbody:last').append( '<tr><td>'+key+'</td>'+ @@ -54,7 +60,10 @@ function requestStatus() { '<td>'+param['help']+'</td></tr>'); $('#button'+key).click(function() { - buttonSetRc("input"+key, key1, key2); + var attr_c = this.getAttribute('data-controllable'); + var attr_p = this.getAttribute('data-param'); + var k = attr_c + "_" + attr_p; + buttonSetRc("input"+k, attr_c, attr_p); }); } } |