-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I have a scenario like this:
<window border="normal" viewModel="@id('vm') @init('ViewModel')"
form="@id('proxy') @init(vm.proxy) @load(vm.obj) @save(vm.obj, before='save')
@validator('ObjValidator', proxy=proxy)"
validationMessages="@id('vmsgs')">
...
</window>
@Init
public void init() {
private Obj obj = getObj();
private Obj proxy = ProxyHelper.createFormProxy(obj, Obj.class);
// set status immediately to dirty
}
@Command
public void save() {
// some save logic;
}
// getters & setters
Is it possibile to update proxy's status to dirty as soon as the proxy is instantiated in the init method? The reason I need this is because I noticed that if I open this page, the proxy is created, then I click a save button to fire the save event and the validator for the proxy is called but the obj is not updated at all. Of course I understand that it makes sense to not update the original object if the proxy is not changed, but in my case I have some logic in the validator to edit the proxy even if the user didn't edit the form at all, therefore i need my original obj to be updated in any case.
I noticed this utility method:
((FormProxyObject) proxy).submitToOrigin(bindContext);
but I don't know what bindContext
is.
UPDATE:
I used the Immutable annotation on the objects that I don't want a proxy around, it seems working but not sure if this is the best solution.
Thank you
Asked: 2021-09-24 18:25:40 +0800
Seen: 2 times
Last updated: Sep 24 '21