Thanks a lot, Dan! With that change, everything started working
perfectly.
El 2016-11-27 10:19, Dan Haywood escribió:
> Thanks for the example.
>
> You can fix this as follows:
>
> //@ViewModel
> @XmlRootElement
> public class SimpleViewModel {
>
> private SimpleObjectDTO filter;
>
> ...
> }
>
> The issue, is that @ViewModel will only serialize out the state of scalar
> value types (strings, dates etc). The SimpleObjectDTO, being a reference
> type, is ignored. It's confusing, because it looks like the value of the
> filter (SimpleObjectDTO) has been set and serialized correctly, however I
> think you would find that just refreshing the SimpleObjectViewModel causes
> its state to get lost once more.
>
> Changing @ViewModel to @XmlRootElement causes the entire graph of objects'
> state, including SimpleObjectDTO, to be captured.
>
> ~~~
>
> Another way to check this: without making the above change, alter the
> SimpleObjectViewModel.layout.xml so that you have the regular title, by
> adding <domainObject/>, eg:
>
> <bs3:row>
> <bs3:col span="11" unreferencedActions="true">
> <domainObject/>
> ...
> </bs3:row>
>
> Then, do the following:
>
> - call filter action, set a value for the name of the SimpleObjectDTO filter,
> eg "Foo"
> - the click on the "ViewModel" title
> - now inspect the property of SimpleObjectDTO filter... it will be null.
>
> Change @ViewModel to @XmlRootElement, and it should be retained
>
> HTH
>
> Dan
--
Hector Fabio Meza
R&D LEAD SMARTOOLS
(57) 300 2254455 [1]
Skype: hectorf.meza
www.smartools.com.co [2]
Links:
------
[1] tel:%2857%29%20300%206815404
[2] http://www.smartools.com.co/