From: Jo-Philipp Wich Date: Sun, 19 Jan 2020 14:52:58 +0000 (+0100) Subject: luci-base: ui.js: support clearChoices()/addChoices() for DynLists X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cc123a03ce738dffae9abf5aefad9b75020a0a04;p=oweals%2Fluci.git luci-base: ui.js: support clearChoices()/addChoices() for DynLists Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 08196117b..08edaa147 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -1555,6 +1555,16 @@ var UIDynamicList = UIElement.extend({ for (var i = 0; i < values.length; i++) this.addItem(this.node, values[i], this.choices ? this.choices[values[i]] : null); + }, + + addChoices: function(values, labels) { + var dl = this.node.lastElementChild.firstElementChild; + L.dom.callClassMethod(dl, 'addChoices', values, labels); + }, + + clearChoices: function() { + var dl = this.node.lastElementChild.firstElementChild; + L.dom.callClassMethod(dl, 'clearChoices'); } });