how to create only one viewmodel object from two different zul files?

asked 2013-05-17 18:01:44 +0800

phdsong gravatar image phdsong
13 3

updated 2013-05-24 15:59:52 +0800

I have several zul files and include those files to create one desktop(ZK term) as below.

    <include id="paDescritpionheaderInclude"
        src="/WEB-INF/zul/productattributedescription/header.zul" />
    <include id="paDescriptionlistInclude"
        src="/WEB-INF/zul/productattributedescription/list_comp.zul" />

    <include id="paDescriptioneditorInclude"
        src="/WEB-INF/zul/productattributedescription/editor_comp.zul" />

In each file, I bind a viewmodel. I ended up with splitting a viewmodel to each separate class because each zul file instantiates its own viewmodel object.

How can I create only one viewmodel object and share it from two zul files so that I don't need to pass shared objects through event queue or global command? For example, I want that both listcomp.zul and editorcomp.zul share a selected object defined as an instance variable in one viewmodel class given that only one viewmodel object is created.

Current my code is using separate viewmodel classes as below. I want to use a class for those two zuls and create only one viewmodel object from two different zul files.




<div apply="org.zkoss.bind.BindComposer"
    viewModel="@id('vm') @init('web.mvvm.product.productattributedescription.ProductAttributeDescriptionEditorViewModel')"
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-09-25 18:04:51 +0800

hasonbro11 gravatar image hasonbro11

i don't know

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2013-05-17 18:01:44 +0800

Seen: 72 times

Last updated: Sep 25 '17

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More