Closed aaloise closed 12 years ago
I would perform a pull request but don't know how to do it
Can you tell me why do it?
MVVM isolates the View layer and the Model layer avoiding tight coupling between the View and Controller layer.
Put UI components in View Model go against MVVM,so it not be advocated.
Well, I just thought that it would be a cool feature to combine Selectors with MVVM if someone needs to do it. I saw it on Access UI Components Inside ViewModel and found it interesting
But if you think that's not a good idea feel free to reject my suggestion, after all you are the project owner
Well,it useful in some case,so I accept your suggestion.
But i will not documented it since we do not encourage this approach.
Btw, you can fork zkui project then pull request your code.
Ok, thank you for accepting the sugestion. I agree with yout about keeping the aproach out of the plugin documentation.
I'll try to pull request the code.
Pull request accepted
Please, add this two lines in org.grails.plugins.zkui.composer.BindComposer
Selectors.wireComponents(comp, _viewModel, true); Selectors.wireEventListeners(comp, _viewModel);
Inside method doAfterCompose right before Selectors.wireVariables(comp, _viewModel, Selectors.newVariableResolvers(_viewModel.getClass(), null));
With that our ViewModels can Wire and Listen just like SelectorComposer. Also including the necessary imports of those two annotations in ViewModel artifact