1. #1
    Sencha Premium Member
    Join Date
    Jun 2010
    Posts
    19
    Vote Rating
    1
    almagnit is on a distinguished road

      0  

    Default ListEditor or ListStoreEditors manipulations

    ListEditor or ListStoreEditors manipulations


    Is it possible to add and edit added proxy to ListEditor?
    I try to do the following:
    Code:
    add.addSelectHandler(new SelectEvent.SelectHandler() {
                @Override
                public void onSelect(SelectEvent event) {
                    ManagerProxy entity = context.create(ManagerProxy.class);
                    entity.setName("Some name");
                    context.edit(entity);
                    listEditor.getList().add(entity);              
                }
            });
    But getting an error:
    Code:
    attempting to edit an entityproxy previously edited by another requestcontext
    Well I try again:
    Code:
    add.addSelectHandler(new SelectEvent.SelectHandler() {
                @Override
                public void onSelect(SelectEvent event) {
                    ManagerProxy entity = context.create(ManagerProxy.class);
                    entity.setName("Some name");
                    driver.edit(entity);
                    listEditor.getList().add(driver.flush());
                }
            });
    Yes it works, but if the added row has changed, then get an error when saving and commiting grid changes:
    Code:
    AutoBean has been frozen

  2. #2
    Sencha Premium Member
    Join Date
    Jun 2010
    Posts
    19
    Vote Rating
    1
    almagnit is on a distinguished road

      0  

    Default


    So, first error was because that I called twice method service.context().

    But now, after editing added proxy I get a second error - "AutoBean has been frozen"

    Also for proxies that have been received from the database, edit works correctly, although they have the same context.

  3. #3
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      1  

    Default


    What is the full stack trace? The first error suggests that somewhere you are using a different context to try to manipulate the same data, and the second suggests that either the data hasn't been edited yet, or the data has already been sent back to the server, the request context closed, and a new one hasn't been created yet to edit the data again.

    This is not a detail about ListEditor or ListStoreEditor, but about how RequestFactory itself works - you must be sure to only edit an object within the same context it was created under, etc.

  4. #4
    Sencha Premium Member
    Join Date
    Jun 2010
    Posts
    19
    Vote Rating
    1
    almagnit is on a distinguished road

      0  

    Default


    Thanks a lot, you are absolutely right in both cases!

    1. Used one serice.context() per editor.
    2. Call setAutoCommit(true) for ListStore
    3. Profit ))

    Tnx Colin

Thread Participants: 1