Finding Record in the Store

Finding Record in the Store

I have JsonStore object and I need to find record with exact match for specific field. I tried 2 things:
1) when building JSON output on server side I added "id" param like that:
{"grid":[{"id":"1","m_regnum":"1610002346"}]}
then on browser side I call store.getById("1") but get undefined as return
2) I try calling store.find("id","1") and it does return correct index but... its partialmatch. In other words if I have another record with "id":13, it also will be found.

Is there way to either do complete match for the field or what do I make wrong in my #1 approach?

I have JsonStore object and I need to find record with exact match for specific field. I tried 2 things:
1) when building JSON output on server side I added "id" param like that:
{"grid":[{"id":"1","m_regnum":"1610002346"}]}
then on browser side I call store.getById("1") but get undefined as return
2) I try calling store.find("id","1") and it does return correct index but... its partialmatch. In other words if I have another record with "id":13, it also will be found.
Thank you.

I think I know what is going on.
Since Im using JsonStore object I do not explicitly specify "reader". Documentation says following: JsonStore is pre-configured with a built-in Ext.data.HttpProxy and Ext.data.JsonReader. Question now is what is the "id" config property that JsonStore sets for the JsonReader. Apparently nothing. I was hoping that JsonStore would at least setup id:"id" as default but its not the case.

I set "id":id in the JsonStore and everything started to work.
Note to myself: pay attention to the bold statements in the help.
Here is what I missed from the documentation: Note: Although they are not listed, this class inherits all of the config options of Store, JsonReader.

This confused me in the beginning. Don't confuse the id you pass from the server and assign in your store with the record id used by ext. I went through my code and changed all references to "id" that were coming from server to "primaryKey" for example just to clarify in my head what was going on.