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=ae2243cb6093f5a15aafbda2ccc154fe9c9aaa6b;p=oweals%2Fluci.git luci-base: ui.js: support clearChoices()/addChoices() for DynLists Signed-off-by: Jo-Philipp Wich (cherry picked from commit cc123a03ce738dffae9abf5aefad9b75020a0a04) --- diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index c9dfea03c..927bda36f 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'); } });