PDA

View Full Version : Question on find (Ext.selectionModel)



jm130794
6 Oct 2012, 11:08 AM
Hello,

I have a strange problem.

In my code, I've this lines :

var theId = operation.records[0].get('id');
console.log("theId: " + theId);  // print 4 in firebug
var index = gridStore.find('id', theId);
console.log("currentRec.save ->; index: " + index); // print 3 in firebug

if (index != -1) {
gridPanel.getSelectionModel().select(index);
}

The selection doesn't work !

Now, if I change
var theId = operation.records[0].get('id');
to
var theId = 4;

... the selection works

and : console.log("theId: " + theId) print 4 in firebug
console.log("currentRec.save -> index: " + index) print 3 in firebug

Why ? the content of theId is always 4 and index is always 3 !!!

Any idea ?

Thanks,

Jean-Michel

scottmartin
6 Oct 2012, 1:44 PM
Perhaps you can show your store data ?
The index is 0 based, where you record most likely starts with an id of 1?

Have a look at your store data and see that the index of the record is not the same as your id field

Scott.