luci-base: cbi.js: await L.ui load before updating tables
authorJo-Philipp Wich <jo@mein.io>
Wed, 9 Nov 2022 19:26:14 +0000 (20:26 +0100)
committerJo-Philipp Wich <jo@mein.io>
Wed, 9 Nov 2022 19:30:20 +0000 (20:30 +0100)
On legacy views, the `L.ui` JavaScript class is not automatically loaded,
so request it before updating tables.

Fixes: e0e6989a4a ("luci-base: introduce new LuCI.ui.Table class")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/cbi.js

index 65ea6bce3cd85d18fd5d4fb8aba81e6aa9df49e7..3fc6edf29fad77395c8666ac55528614d2ab7edd 100644 (file)
@@ -796,5 +796,7 @@ document.addEventListener('DOMContentLoaded', function() {
                        L.hideTooltip(ev);
        });
 
-       document.querySelectorAll('.table').forEach(cbi_update_table);
+       L.require('ui').then(function(ui) {
+               document.querySelectorAll('.table').forEach(cbi_update_table);
+       });
 });