1. #1
    Sencha Premium Member
    Join Date
    Jul 2008
    Posts
    17
    Vote Rating
    0
    winter is on a distinguished road

      0  

    Default Unanswered: Editable grid RequestFactory - save

    Unanswered: Editable grid RequestFactory - save


    I'm trying to figure out the (best) approach for saving changes made with GridEditing when the datastore is populated with EntityProxies using requestfactory.

    My current strategy:

    populate grid:
    1) requests all entityproxys
    2) for each entityproxy request an editable entityproxy and add this to the store

    save grid:
    1) put the changed entityproxys in a list using store.getModifiedRecords()
    2) store.commitChanges()
    3) use the list to save the changed entityproxies with requestfactory

    This works, but I feel like I only should request editable entityproxies when actually trying to save the changes to them, but I have no idea how to do that. Any recommendations?

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    8
    Vote Rating
    0
    rajsingh is on a distinguished road

      0  

    Default


    I have a related issue

    http://www.sencha.com/forum/showthre...RequestFactory


    What you could do is potentially use the store.addStoreRecordChangeHandler .. and insert an editable proxy at that index ... but its not working .. you might end up getting:

    Caused by: java.lang.IllegalStateException: A request is already in progress

    when you persist :-(

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2008
    Posts
    17
    Vote Rating
    0
    winter is on a distinguished road

      0  

    Default


    If you get the "A request is already in progress", that indicates you're callin edit with a requestcontext that allready has been fired. You should use a new requestcontext. Would this fix your problem?



  4. #4
    Sencha User
    Join Date
    Jun 2011
    Posts
    8
    Vote Rating
    0
    rajsingh is on a distinguished road

      0  

    Default


    Hmm .. a new request object is being used:

    One commit is called on the grid/store, this is invoked.

    Code:
    store.addStoreUpdateHandler(new StoreUpdateEvent.StoreUpdateHandler<AddressProxy>() {
                @Override
                public void onUpdate(StoreUpdateEvent<AddressProxy> event) {
    
    
                    List<AddressProxy> items = event.getItems();
    
    
                    for(AddressProxy proxy : items) {
    
    
                        addressRF.addressRequest().persist().using(proxy).fire(new Receiver<Void>() {
                            @Override
                            public void onSuccess(Void response) {
                                System.out.println("Received persist response from server");
                            }
                            @Override
                            public void onFailure(ServerFailure error) {
                                System.out.println("Error from persist response from server - " + error.getMessage());
                            }
                        });
    
    
    
    
                    }
                }
            });
    This is from the store insertion:

    Code:
    addressRF.addressRequest().findAll().fire(new Receiver<List<AddressProxy>>() {
                @Override
                public void onSuccess(List<AddressProxy> response) {                
                    store.clear();
                    for( AddressProxy proxy : response) {
                        AddressProxy editable = addressRF.addressRequest().edit(proxy);
                        store.add(editable);
                    }
                    gridPanel.forceLayout();
                }
    
    
                @Override
                public void onFailure(ServerFailure error) {
                    System.out.println("Error from findAll  - " + error.getMessage());
                }
            });
    Will try to keep looking ..

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi