0

MVVM Tree Example

asked 2012-06-27 13:31:25 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

I could not able to find a complete example using MVVM - Tree component.

Can you someone give me the link

delete flag offensive retag edit

4 Replies

Sort by » oldest newest

answered 2012-06-28 01:43:06 +0800

MontyPan gravatar image MontyPan
435 3
http://xitop.blogspot.com...

I can't find too... :'(
But, maybe my personal experience can help you, if you can use Tree component in MVC.

Suppose "vm" is your ViewModel id in ZUL.
# add model attribute value:

<tree model="@load(vm.fooTreeModel)" >

# write <template> like this :

		<template name="model" var="foo">
			<treeitem>
				<treerow>
					<treecell label="@load(foo.data.fieldA)" />
					<treecell label="@load(foo.data.fieldB)" />
				</treerow>
			</treeitem>
		</template>

Original ${each.fieldName} in MVC is replace by @load(foo.fieldName)

# The ViewModel class (is a POJO) need a method getFooTreeModel(), which return type is the same as the parameter type of foo.setModel in ComposerImplement.doAfterCompose() .

Hope these simple steps can help you to transform your MVC program to MVVM.

Regards,
Monty Pan

link publish delete flag offensive edit

answered 2012-08-19 10:36:18 +0800

pasqualeleone gravatar image pasqualeleone flag of Italy
81 2

updated 2012-08-19 10:36:31 +0800

Hi,
have found a solution to the tree?
there is an example available?
thank you

link publish delete flag offensive edit

answered 2012-08-20 04:40:06 +0800

MontyPan gravatar image MontyPan
435 3
http://xitop.blogspot.com...

Hi all,

Ok, here we are... \囧/

I write a simple but complete(maybe) example of Tree by ZK MVVM.
I put these code on github:
mvvmTree.zul
TreeVM.java
Product.java

Any feedback is welcome.

Regards,
Monty Pan

link publish delete flag offensive edit

answered 2012-08-21 09:02:57 +0800

pasqualeleone gravatar image pasqualeleone flag of Italy
81 2

thank you MontyPan!
i founded also this example :
http://zkfiddle.org/sample/3dm77ch/1-MVVM-tree#source-2

link publish delete flag offensive edit
Your reply
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

Follow

RSS

Stats

Asked: 2012-06-27 13:31:25 +0800

Seen: 354 times

Last updated: Aug 21 '12

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