PDA

View Full Version : Ext.plugin.PullRefresh : how to add only new record



lu2vik
18 Apr 2012, 1:40 PM
Hi,

I would like to know how I can add only new records with the Ext.plugin.PullRefresh ?

I followed the sample but the old records are also added ...

When I look at the source code of onLatestFetched method :



...
newRecord = newRecords[i];
alert(newRecord.getId());
oldRecord = oldRecords.getByKey(newRecord.getId());

if (oldRecord) {
oldRecord.set(newRecord.getData());
} else {
toInsert.push(newRecord);
}
...


The getter newRecord.getId() returns a new Id each time. Same on the old records.

Any idea ? Maybe, must I send (in json) only the new records ?

Thanks a lot !

scottmartin
19 Apr 2012, 8:25 AM
It looks like it is setup to return all records, new and old .. ie: refresh). You could most likely update it to not include if oldRecord is true.

Regards,
Scott.