diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-11-20 22:08:23 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-11-20 22:08:23 +0100 |
commit | 0eff9776fa119fddea9bb65168632627b82163be (patch) | |
tree | 3812f068ad87936f7b236c360fb47e2457eefcc8 | |
parent | Start adding binding stuff too rrule edit form. (diff) | |
download | calp-0eff9776fa119fddea9bb65168632627b82163be.tar.gz calp-0eff9776fa119fddea9bb65168632627b82163be.tar.xz |
Start looking into generalized input-list.
Diffstat (limited to '')
-rw-r--r-- | static/input_list.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/static/input_list.js b/static/input_list.js index b15162d6..79e223c3 100644 --- a/static/input_list.js +++ b/static/input_list.js @@ -73,5 +73,26 @@ function init_input_list() { transferListeners(oldUnit, unit); lst.unit = unit; + + if (lst.dataset.bindby) { + lst.get_value = lst.dataset.bindby; + } else if (lst.dataset.joinby) { + lst.get_value = get_value(lst.dataset.joinby); + } + } else { + lst.get_value = get_get_value(); + } } } + +/* -------------------------------------------------- */ + +/* different function forms since we want to capture one self */ +const get_get_value(join=',') => function () { + return [...self.querySelectorAll('input')] + .map(x => x.value) + .filter(x => x != '') + .join(join); +} + +/* -------------------------------------------------- */ |