luci-base: ui.js: support clearChoices()/addChoices() for DynLists
authorJo-Philipp Wich <jo@mein.io>
Sun, 19 Jan 2020 14:52:58 +0000 (15:52 +0100)
committerJo-Philipp Wich <jo@mein.io>
Sun, 19 Jan 2020 15:15:22 +0000 (16:15 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/ui.js

index 08196117b0483d42c6c6cb9d0c1c12a18f0ac5ac..08edaa1475a48915e29fa85f1d2842756323471b 100644 (file)
@@ -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');
        }
 });