1. #1
    Sencha Premium Member
    Join Date
    Mar 2013
    Posts
    35
    Answers
    4
    Vote Rating
    0
    BKrones is on a distinguished road

      0  

    Default Answered: Modify Pullrefresh Plugin

    Answered: Modify Pullrefresh Plugin


    Hi,
    i got a list using Pullrefresh Plugin, but it only refreshes new added records.
    Updated and deleted records are not updated ( only json-data is loaded correctly but not snychronized to current store )

    I found solution to solve delete issue, but i am not able to use this in Sencha Architect:
    Does anyone know the equivalent
    Code:
    Ext.define('TP.extend.override.PullRefresh', {    override: 'Ext.plugin.PullRefresh',
    
        onLatestFetched: function(operation) {
            var store           = this.getList().getStore(),
                oldRecords      = store.getData(),
                old_length      = oldRecords.length,
                newRecords      = operation.getRecords(),
                length          = newRecords.length,
                toInsert        = [],
                newRecordIds    = [],
                oldRecordsArr   = [],
                toRemove        = [],
                newRecord, newRecordIndex, oldRecord, i;
    
            for (i = 0; i < length; i++) {
                newRecord = newRecords[i];
                oldRecord = oldRecords.getByKey(newRecord.getId());
    
                newRecordIds.push(newRecord.getId());
    
                if (oldRecord) {
                    oldRecord.set(newRecord.getData());
                } else {
                    toInsert.push(newRecord);
                }
    
                oldRecord = undefined;
            }
    
            store.insert(0, toInsert);
            oldRecordsArr = store.getRange();
            for (i = 0; i < old_length; i++) {
                oldRecord = oldRecordsArr[i];
                newRecordIndex = newRecordIds.indexOf(oldRecord.getId());
    
                if (newRecordIndex == undefined || newRecordIndex == -1) {
                    toRemove.push(oldRecord);
                }
    
                oldRecord = undefined;
            }
            store.remove(toRemove);
        }
    });

  2. Right click on the Plugin in the toolbox, click Create Override.

    Then put the updated code in the override. This will change all of the PullRefresh instances to use the new code you've provided. Mind you when using overrides like this you will need to make sure the code is updated to work with the latest code whenever you update the library.

  3. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,198
    Answers
    61
    Vote Rating
    120
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Right click on the Plugin in the toolbox, click Create Override.

    Then put the updated code in the override. This will change all of the PullRefresh instances to use the new code you've provided. Mind you when using overrides like this you will need to make sure the code is updated to work with the latest code whenever you update the library.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

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