1. #1
    Sencha User aflx's Avatar
    Join Date
    Jun 2011
    Location
    Berlin, Germany
    Posts
    64
    Vote Rating
    0
    aflx is on a distinguished road

      0  

    Question Operation resultSet vs. records

    Operation resultSet vs. records


    Hi,

    can anyone please explain the differences between Operation.resultSet and Operation.records!?
    Since PR4 it seems that a proxy has to set both on success, in PR3 only resultSet was set.

    For example WebStorage.read():

    PR3:

    Code:
    ...
    operation.setCompleted();
    
    operation.resultSet = Ext.create('Ext.data.ResultSet', {
        records: records,
        total  : records.length,
        loaded : true
    });
    
    if (typeof callback == 'function') {
        callback.call(scope || this, operation);
    }
    ...
    PR4:

    Code:
    ...
    operation.setCompleted();
    
    operation.setResultSet(Ext.create('Ext.data.ResultSet', {
        records: records,
        total  : records.length,
        loaded : true
    }));
    operation.setRecords(records);
    
    if (typeof callback == 'function') {
        callback.call(scope || this, operation);
    }
    ...
    What is it good for to set records, it is already set in the resultSet!?

    Thanks!
    Alex

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    The reason this looks a bit funny in WebStorage is because it is trying to create the exact same result as a Server proxy.

    One of the bigger changes in the data package is that when a proxy processes a response from the server, it calls reader.process() passing the response. The reader reads out the data and returns a ResultSet with the data in the "records" config. We then call operation.process() passing this ResultSet. The operation will handle each type of action (read, update, create, destroy), and then calls this.setRecords() after it is done processing. We then pass the Operation to the callback.

    All this means is that in the callback, the way you have to get the record instances is to call operation.getRecords(). Again, the reason this all looks a bit funny in the WebStorage proxy is because when we get data from LocalStorage, we don't have the reader actually process this ResultSet.

    In the old data package reader.read() was called which actually returned Model instances. We then had code spread out everywhere that would merge and commit these new record instances with the old ones, which often actually didn't work at all.

    Sorry if my explanation is a bit hard to understand. Let me know if you have any more questions about this.

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