I have a store which is defined something like this:
var AdditionalGridData = new Ext.data.JsonStore(
{ root: "result",
data: { result: Ext.decode(this.Data.AdditionalGridData) },
idProperty: 'iD',
fields: [
{ name: "iD", type: "int", allowBlank: false }, //must match selected row's primary key
{name: "SomeText", type: "string" }
]
});
So there is a time when I want to get an existing record by it’s ID value. I call getById and it returns undefined. The store really contains the record that I am searching. Why could it not return my record?
Read somewhere on the forums that:
you need to pass record id (f.e. “ext-record-1”) to Store.getById instead of your data ID (f.e. “1”);
Is this correct? Where do I get that record id?
I was inserting the records incorrectly. I was inserting them like .add({ContactName:”aaa”},{ContactID:1}), and should have done it like .add({ContactName:”aaa”}, 1);