Wednesday, September 28, 2011

Re: Is there a way to cancel/destroy a RequestContext or EditorDriver while editing?

You don't need to decide whether you call persist(), or remove(),
until the user decides to save or delete the entity, so you can use a
RequestContext to start editing, and later, depending on what the user
decides to do, call either persist() or remove() in that same
RequestContext.

Slightly inefficient I suppose, as the changes made to the Entity will
still get sent to the server even when calling remove(). If you don't
want to send the changes when calling remove, simply do not fire() the
context you are editing in (effectively throwing it away), and create
a second context to call remove() on.

On Wed, Sep 28, 2011 at 11:10 AM, tom <majortom324@gmail.com> wrote:
> Hi,
>
> in my app, I've got an edit form which uses the Editor framework to edit an
> EntityProxy.
>
> There's also a delete function, which may be activated while an entity is
> being edited.
>
> Now the problem is that I can't just open a new RequestContext for an Entity
> and call remove() on it while it is still being edited (as that would mean
> "crossing the beams"). So what it does now is first persist() the edited
> Entity and then remove() it, which causes unnecessary traffic and delay.
>
> How can I tell my EditorDriver to cancel editing? Or alternatively throw
> away the whole RequestContext in which the editing takes place?
>
> Regards
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/85SdohRBg6sJ.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment