PDA

View Full Version : [DUP] Ext.data.Store's function: findBy doesn't works



Garpun_13
3 May 2013, 2:59 PM
REQUIRED INFORMATION

Ext version tested:

Ext 4.2.0.663
Browser versions tested against:

Chrome
IE8
Safari 4
Description:

Ext.data.Store#findBy(..) -fails
ERROR: "TypeError: Object [object Object] has no method 'findIndexBy'" (I guess, that "object" -is Ext.data.Store#data)
Steps to reproduce the problem:

Call function: findBy() for existing store.
The result that was expected:

index of record or -1
The result that occurs instead:

fails to execute function
Test Case:


Ext.application({
launch:function(){

var store = Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data:{'items':[
{ 'name': 'Bart', "email":"bart@simpsons.com", "phone":"555-222-1234" },
{ 'name': 'Lisa', "email":"lisa@simpsons.com", "phone":"555-111-1224" },
{ 'name': 'Homer', "email":"home@simpsons.com", "phone":"555-222-1244" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});
var lisaInd = store.findBy( function( rec, id ) {
if ( rec.get('name').toLowerCase() == 'lisa' ) {
return true;
}
return false;
} );
Ext.MessageBox.alert( 'lisa\'s index in the store: ' + lisaInd );
}
});


HELPFUL INFORMATION

Ext.data.Store#findBy(..) worked properly in ExtJs 4.1, but in 4.2.0 it fails,

evant
3 May 2013, 5:25 PM
Your test case doesn't throw any exception, but I think you're probably referring to this:

http://www.sencha.com/forum/showthread.php?262127

Garpun_13
3 May 2013, 5:45 PM
result for my test case is as expected, with Ext Js 4.1:
43524
but with 4.2 no any alert...

Garpun_13
11 May 2013, 6:33 PM
Your test case doesn't throw any exception,
Yes, because in the test case, I've missed "buffered=true" configuration of a store, if you add this config, it throws..

but I think you're probably referring to this:
http://www.sencha.com/forum/showthread.php?262127
It seems you're right. thanks for the reply.