PDA

View Full Version : [CLOSED] Weird store call in `Ext.selection.Model`



zerkms
12 Aug 2013, 7:43 PM
Version: 4.2.0

In `Ext.selection.Model::storeHasSelected()` there is a line

if (record.hasId() && store.getById(record)) {

and the store's getById is implemented as:


getById: function(id) {
var result = (this.snapshot || this.data).findBy(function(record) {
return record.getId() === id;
});
//<debug>
if (this.buffered && !result) {
Ext.Error.raise('getById called for ID that is not present in local cache');
}
//</debug>
return result;
},

as You can see - we pass a record as an `id` parameter, so obviously the `result` here will always be `null`. Thus we get a error raised.

Am I missing something?

PS: sorry for the exact copy-paste of my old question from http://www.sencha.com/forum/showthread.php?262118-Weird-store-call-in-Ext.selection.Model but seems like as soon as it's marked as [Fixed] (while it's not) it doesn't bring as much attention as it supposed to.

evant
12 Aug 2013, 8:07 PM
The latest code has been updated.

It now reads:



if (record.hasId() && store.getById(record.getId())) {