-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi everybody,
I've got an abstract class where all my VMs inherit from. I could have an @Init annotated method in the abstract class, but ZK won't evaluate it. So I have to have this init method in every subclass:
@Init
@Override public void init()
{
super.init();
}
I've read the docs on how to call an additional init() method in the parent class. But there seems to be no way to have the @Init method ONLY in the parent class, right? Why is that?
I'm happy to provide a patch which fixes this if there's no reason to not do it.
Cheers, Thomas
I think the ZK guys assumed that in most cases you will always need an @init method in your view model to retrieve parameters and prepare data models. Anyway, i believe that a declaration like this is not a big thing:
@Init(superclass=true)
public void init() { }
Costas
Hi Thomas. Yes, it's possible.
In your concrete viewmodel define the annotation at class level:
@Init(superclass = true)
public class ManageCitiesViewModel extends CrudViewModel<city>
Then in yout abstract class:
@Init
public void load()
It's working fine for me. If this is what you want please vote me. Regards!
Asked: 2015-01-21 15:16:45 +0800
Seen: 24 times
Last updated: Jan 23 '15
Problem binding values to a composite component
How to access static member field of a class in zul without zscript
How can i load a constant in .zul
MVVM Validator: class not found ? [closed]
MVVM tab box - delay @load until tab pane displayed?
mvvm, load or save with after or before for seach command
how to fire an event when a variable value loaded through VM
is there any event trigger from zk component on binding ?
ZK team plans to dispose of Composer EventQueues no longer in scope? [closed]