Hello,
Just a follow up on this from awhile back, since someone might encounter it
again.
The problem, which someone pointed out off-list, is that triggering an ajax
form submit using jQuery does a complete non-Ajax page load, but then dumps
that page. So, the model was being updated on subsequent pages, but those
pages were not being displayed and the original page had stale data.
Perhaps there is a way to access the page map and make the appropriate
adjustments, but I decided to dive into the wicket-ajax.js and execute the
wicketSubmitFormById() myself.
The end result is that I have a AjaxAutoSavingSubmitLink (which extends
AjaxSubmitLink) with some supporting Javascript and it's working well with
TinyMCE, and SvgEditors.
Thanks for the help!
Jake
jbrookover wrote:
>
> Hey all,
>
> I have a component, ResponseArea, that get's a
> HibernateObjectModel<Response>. This ResponseArea then passes that same
> model down to it's sub components (ResponseEditor, ResponseViewer).
>
> ResponseEditor passes this model further down to a Form<Response>. I have
> some jQuery script that does a timed autosave submit of this form.
>
> When the form submits, I do this (pseudocode):
>
> Response newR = new Response();
> newR.setData(Form.this.get("dataField").getDefaultModelObjectAsString();
> saveResponse(Form.this.getModelObject(), newR);
>
> The last step of the saveResponse(Response oldR, Response newR) method
> does some processing, comparing the two versions of the response, and
> finally calls:
>
> ResponseEditor.this.setDefaultModelObjet(newR);
>
> Now, I expect this effect to propagate up to the parent ResponseArea and
> down to the Form to be ready for the next AutoSave. The problem is this:
>
> At some point in the processing, the Form seems to clone the model and
> never gets the new object - it retains the original object as its model
> object. So instead of this behavior
>
> 1st Autosave Execute: saveResponse(original, respond1)
> 2nd Autosave Execute: saveResponse(respond1, respond2)
> 3rd Autosave Execute: saveResponse(respond2, respond3)
>
> I get this:
>
> 1st Autosave Execute: saveResponse(original, respond1)
> 2nd Autosave Execute: saveResponse(original, respond2)
> 3rd Autosave Execute: saveResponse(original, respond3)
>
> Since my form would like to see progressive changes, this doesn't work.
>
> Thoughts?
>
> I sense IComponentInheritedModel is involved, but I'm surprised that this
> isn't a native behavior. It also seems to work in every other case - so
> why not now?
>
> Thanks!
>
> Jake
>
>
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Model-not-Updating-on-Multiple-Form-Submits-tp2272644p2286475.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]