From cc123a03ce738dffae9abf5aefad9b75020a0a04 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 19 Jan 2020 15:52:58 +0100 Subject: [PATCH] luci-base: ui.js: support clearChoices()/addChoices() for DynLists Signed-off-by: Jo-Philipp Wich --- modules/luci-base/htdocs/luci-static/resources/ui.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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'); } }); -- 2.25.1