-
FEATURED COMPONENTS
First time here? Check out the FAQ!
In the Documentation ( http://books.zkoss.org/wiki/ZK%20Developer's%20Reference/MVVM/Data%20Binding/EL%20Expression), they have said the following
Call ViewModel Methods
You can use EL expression to call a method in a ViewModel.
Call concat() of a ViewModel
1
<label value="@load(vm.concat(vm.foo,'postfix'))"/>
Can someone give a simple example for this
Regards
Senthil M
I'm trying to do this one, but the method doesn't receive anything.
<tabpanel forEach="${vm.set}"> <grid model="@load(vm.getEvents(each.key))"> ......
If you get a example, please post it.
Thanks you.
Sorry, but I think you guys have seriously misread this. The concat does not allow you to pass parameters to a viewmodel method in the @load binding.
The concat() is merely an EL syntax for concatenating two strings. See any JSP EL guide. So, in your case, I believe it will concat the returned string from vm.foo with 'postfix' to dynamically determine a vm method to call in the @load binding. It will end up calling a method, in the viewmodel, whose name is the concatenation of (some-string-value-returned-from-foo + postfix) upon @load. So, I'm not sure where you gathered that the concat() was a way to pass parameters. Again, remember that any such reference to @load(vm.someProperty) is really telling the bindcomposer to look in the viewmodel for a method getSomeProperty() and retrieve those contents. Getters do NOT accept arguments in the traditional sense of getters.
Try this link for a better idea of how to handle things when it comes to tabs.
Thank you. I am aware of concat, but i dont know to how to call viewmodel method on @load and also passing arguments. If you have any simple example, please let me know.
Asked: 2012-11-17 10:32:16 +0800
Seen: 221 times
Last updated: Nov 19 '12