This content has been marked as final.
Show 3 replies
-
1. Re: Errai @ModelSetter Unsettles Data-Binding ?
mbarkley Dec 12, 2013 11:06 AM (in response to chaluwa)1 of 1 people found this helpfulHey Charles,
Thanks for posting this. It looks like there's a bug with the
@ModelSetter
where the binding does not work when called from within the declaring class. I've filed a jira about it.In the mean time, you could use a
DataBinder
instead of the@Model
declaration.Instead of:
@Inject @Model ModelType model;
You can do this:
@Inject @AutoBound private DataBinder<ModelType> binder;
Then to set and get the model:
binder.setModel(model); // Gives back the bound model binder.getModel();
Cheers.
-
2. Re: Re: Errai @ModelSetter Unsettles Data-Binding ?
chaluwa Dec 12, 2013 11:34 AM (in response to mbarkley)Ok. good. But is there still benefit to wrap binder.setModel(model); inside a @ModelSetter method ? E.g :
@ModelSetter private void setModel(PutmeSubjectBundle model){ binder.setModel(model); }
-
3. Re: Re: Errai @ModelSetter Unsettles Data-Binding ?
mbarkley Dec 12, 2013 11:38 AM (in response to chaluwa)1 of 1 people found this helpfulNo, you should get rid of the @ModelSetter annotation if you use a DataBinder. Calling setModel on the DataBinder is the only thing you need to replace the model.