-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
my problem is simple. I have a listbox defined like this :
<listbox id="refTypeL"
model="@load(vm.referenceTypes)"
selectedItem="@bind(vm.refTypeSelected)"
mold="select"
disabled="@load(not empty vm.id)"
width="150px"
sclass="h3Field" >
<template name="model" var="itemRefT">
<listitem label="@load(itemRefT.typeTranslated)" />
</template>
</listbox>
And i would like to show a div depending on selection in listbox... I try this :
<div sclass="h3" visible="${refTypeL}.selectedIndex eq 2">
But selectedIndex is not refreshed.
Any idea ? Thank you
What i can suggest you,
1-First create a class variable in View Model.
2-Create a new method and Notify This Variable when any item selected and inside this method you can write the logic to get selectedindex and update your class variable and bind this variable your zul page .
3- Now in zul the above bind variable will be use in div's visible attribute .
Hi mychal,
do it like :
<div sclass="h3" visible="${refTypeL.selectedIndex eq 2}">
reply if this works.Otherwise do as @sjoshi suggests,that's also a good idea to have flexibility in your code.
i have tried ${refTypeL.selectedIndex} eq 2 and ${refTypeL.selectedIndex eq 2}. Nothing is working. The pb is that selectedIndex is not refreshed. yeah the solution in viewmodel is easy to apply, but i was thinking that EL expression were there to gain time and reduce code :p Thank you anyway ;-)
Mychal ( 2013-07-29 15:16:56 +0800 )editAsked: 2013-07-18 13:34:53 +0800
Seen: 40 times
Last updated: Jul 19 '13
Databinding and auto-complete on combobox
Composite component and bind in ZK 6
How to detach / reattach MVVM windows?
Is there a way to resolve view model properties as input to client side javascripts?
How can I synchronize data in a ListBox in MVVM ? [closed]
MVVM Validator: class not found ? [closed]
How to Call Child ViewModel Method from Parent Window? [closed]