answered
2021-10-20 10:24:08 +0800
cor3000 6280 ● 2 ● 7 The documentation for the special if attribute shows that it requires an EL expression and not a @load
binding annotation
That's why your usage has no effect. The if attribute is NOT a component propery, and hence no property binding will have an effect. It's an instruction for the ZUL parser/evaluator to include a component in a page or not at all.
<listbox if="@load(vm.modelNumber == 1)">
If you want to evaluate the listbox once statically you can use an EL-expression:
<listbox if="${vm.modelNumber == 1}">
For a dynamic usage ZK (EE) provides the shadow-<if> element.
<if test="load(vm.modelNumber == 1)">
<listbox ...>
</if>
In ZK CE you can use the uglier "single-children-binding" (as I call this). This will evaluate the template if the @load binding result is non null.
<div children="@load(vm.modelNumber == 1 ? 'dummy' : null)">
<template name="children">
<listbox ...>
</template>
</div>