Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

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

      0  

    Default GXT 3.0 Grid/Store Persistence Issues - RequestFactory

    GXT 3.0 Grid/Store Persistence Issues - RequestFactory


    Hi

    There are no examples showing grid store persistence to RequestFactory, there are issues with persisting records as you need to call edit on the request prior to persistence.

    You can do this 2 ways, but I don't think either is right

    1) Before adding proxy entities to the store, add an editable version:
    ..
    for( AddressProxy proxy : response) {
    ExerciseProxy editable = addressRF.addressRequest().edit(proxy);
    store.add(proxy);
    }

    But then when you call store.commitChanges() it complains about "A request is already in progress"

    2) Intercept StoreRecordChangeEvent.StoreRecordChangeHandler event and then do something like this:

    store.addStoreRecordChangeHandler( new StoreRecordChangeEvent.StoreRecordChangeHandler<AddressProxy>() {
    @Override
    public void onRecordChange(StoreRecordChangeEvent<AddressProxy> event) {
    int index = grid.getStore().indexOf( event.getRecord().getModel() );
    AddressProxy proxy = event.getRecord().getModel();
    AddressProxy editable = addressRequest.edit(proxy);
    store.add(index, editable);
    }
    });

    Both have the same issue:

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


    Has anyone managed to successfully persist updates from a grid store to RequestFactory = > DB ?

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

      0  

    Default


    I made this work using method 1.

    for( AddressProxy proxy : response) {
    ExerciseProxy editable = addressRF.addressRequest().edit(proxy);
    store.add(proxy);
    }


    Needs to be:

    Code:
    AddressRequestContext addressRequestContext = 
    addressRF.addressRequest();
    for( AddressProxy proxy : response) {
    store.add(addressRequestContext.edit(proxy)); }



    when saving you need to do something like this:
    Code:
    List<AddressProxy> changes = new ArrayList<AddressProxy>();
    Code:
    for (Store.Record record : store.getModifiedRecords()) {
      changes .add( (AddressProxy) record.getModel());
    }
    
    store.commitChanges();
    
    addressRequestContext.saveAll(changes).fire(new Receiver<Void>() {
        @Override
        public void onSuccess(Void response) {
             //saved hooraj!
       }
    });

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

      0  

    Default


    Thanks winter.

    I made more progress and have 90% of this working, but having issues with persisting a record.

    What happens is that when I save a new record, i get 2 back from persistence:
    1) The new one
    2) The old one

    Will keep working to iron out these issues. Have attached an example (with the issue above) for anyone else who wants to use.

    Note:
    1) Uses JDO/HSQL as persistence (you can switch between this and app engine by change PMF to retrieve "transactional" - see jdoconfig.xml)
    2) You have to set up the annotation processor in Intellij so it parses the RequestFactory items
    3) Each time you search for records and add them to the store, you need to use the same request instance to save. Normal fire requests can use new instances of request.

    This is not a runnable example as is - you still need to build/deploy it, but the source is there for reference.

    Its a modification of the Plant/Editable Grid example, where instead of plants we have Addresses so you can
    1) Add
    2) Find By City
    3) Load All

    Thx
    Attached Files

Thread Participants: 1