# Update dirty property of proxy

aUser
133 4

Hello,

I have a scenario like this:

<window border="normal" viewModel="@id('vm') @init('ViewModel')"
@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

delete retag edit
Be the first one to answer this question!
[hide preview]