luci-base: Fix using isActive in widget-change notification.

The `onchange` notification handler is called too early to be able to
evaluate other widget's `isActive()` status. Solve this by changing order
of event handling - first register/execute `map.checkDepends` and then
`onchange`.

Fixes: openwrt/luci#4516.

Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
This commit is contained in:
Oldřich Jedlička 2020-10-20 20:15:30 +02:00
parent 6125c9178e
commit ee9b3a4e94

View file

@ -3351,10 +3351,10 @@ var CBIValue = CBIAbstractValue.extend(/** @lends LuCI.form.Value.prototype */ {
optionEl.classList.add('hidden'); optionEl.classList.add('hidden');
optionEl.addEventListener('widget-change', optionEl.addEventListener('widget-change',
L.bind(this.handleValueChange, this, section_id, {})); L.bind(this.map.checkDepends, this.map));
optionEl.addEventListener('widget-change', optionEl.addEventListener('widget-change',
L.bind(this.map.checkDepends, this.map)); L.bind(this.handleValueChange, this, section_id, {}));
dom.bindClassInstance(optionEl, this); dom.bindClassInstance(optionEl, this);