1. #1
    Sencha User
    Join Date
    Dec 2010
    Posts
    74
    Vote Rating
    1
    Johnbran is on a distinguished road

      0  

    Default Unanswered: Store.sync() destroy action

    Unanswered: Store.sync() destroy action


    Hello,
    I am trying to get store.sync() to work. I have it working great with updating and adding records. I can't get it to tell the server that it is destroying a record.

    this is the basic sync code that I am calling.
    Code:
    Store = Ext.StoreMgr.lookup('locationsStore');
    Store.sync({
        success: function (batch, opts) {
            console.log(batch);
        },
        failure: function (response, opts) {
    
    
        }
    
    
    });
    It calls my php file twice, once for modifying the record and once for destroying it (when there is a add and destroy action to be full filled).

    As you can see from the console log it does two operations, an update and destroy. How can I get it to tell the PHP application what operation it is performing?

    Code:
    i {proxy: i, listeners: null, hasListeners: e, events: Object, operations: Array[2]}
    • current: 1
    • events: Object
    • exceptions: Array[0]
    • hasException: false
    • hasListeners: e
    • isComplete: true
    • isRunning: false
    • listeners: null
    • operations: Array[2]
      • 0: i
        • action: "update"
        • batch: i
        • complete: true
        • records: Array[1]
        • request: i
        • response: Object
        • resultSet: i
        • running: false
        • started: true
        • success: true
        • __proto__: a
      • 1: i
        • action: "destroy"
        • batch: i
        • complete: true
        • records: Array[1]
        • request: i
        • response: Object
        • resultSet: i
        • running: false
        • started: true
        • success: true
        • __proto__: a
      • length: 2
      • __proto__: Array[0]
    • proxy: i
    • total: 2
    • __proto__: a
    the Form data it post is identical except for the json data it is passing.

    Any help will be appreciated, thanks

  2. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,084
    Answers
    112
    Vote Rating
    95
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    such problems mostly occur when an id field is not being properly used. Do you have an id field in of type int in your model? if you are using some other name for your id field, you have to specify it in the proxy's ready using idProperty config.

    Other than that, you can check e.g. after calling store.remove() to delete a record, do the following:

    Code:
    console.log(store.getNewRecords());
    console.log(store.getRemovedRecords());
    console.log(store.getUpdatedRecords());
    only getRemovedRecords should return the record to be deleted and the other two should return an empty array if you didnt add or update any record.

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