I'm working on a project using zk framework. I have many users who can use the application at the same time.
If one of them change a value of a field and fire the @notifychange
I want to update the views of all other users.
For example if all the users are in the same page
<window title="Search" width="600px" border="normal"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('demo.getting_started.mvvm.SearchViewModel')"
binder="@id('b') @init('demo.getting_started.mvvm.AnnotateBinderExt',queueName='myqueue',queueScope='session')">
<hbox align="center">
Keyword:
<textbox id="txt" value="@bind(vm.keyword)" />
Result:
<textbox value="@load(vm.keyword)" />
</hbox></window>
and one of them change the value of the textfield I want update the value of the label for the other users.
I'm trying to work with the eventQueue
but couldn't out how to implement it.
Your almost there.
The reason why it doesn't change is because @notifychange is propably called from a Command
in stead of a GlobalCommand
.
Take a look at this small talk what I wrote.
@Command
is always the same viewmodel, @GlobalCommand
can reach out to other viewmodels in the binders scope.