PDA

View Full Version : [SOLVED] Finding value in JsonStore



roki13
21 Jul 2008, 5:06 AM
Hi there,

sorry for this basic question but couldn't find any post on this.

I'm trying to find the index of a matching record of a JsonStore using the 'find' method.

Problem is 'find' will match any property the searched value begin with.

Example: I'm searching for 1; 10 will be a matching value.

Is there a way around that? I have specified my field as being an int, but that doesn't help. Please let me know if you need more info on what I'm trying to achieve.

Many thanks,

seb

willgillen
21 Jul 2008, 5:31 AM
According to the API Docs, you can use RegEx to search your JsonStore using the 'find' method.
http://extjs.com/deploy/dev/docs/?class=Ext.data.JsonStore:

"Either a string that the property value should begin with, or a RegExp to test against the property."

Then you can use some RegEx to refine your search better. I'm no RegEx(pert), so here is a link to get you going:
http://www.regular-expressions.info/



-- W.G.

roki13
21 Jul 2008, 6:02 AM
Hi,

thanks for the answer. I wasn't sure I could use RegExp in my case because I was working with dynamic patterns, but yeah, that worked :)


Cheers,
seb