I have a JSON array list, I am matching the "Name" item against 1 or
more items in my match array.
Pseudo:
for each list.item
if item "Name" contains one and every (must match every item in array)
then: TRUE
return new item to filtered list
Example Data:
Apple Martini
Gin Martini
Slippery Nipple
T&T
Gin Fizz
A Gin X Martian
Example User Input:
gin
Result:
Gin Martini
Gin Fizz
A Gin X Martian
Example User Input:
gin mart
Result:
Gin Martini
A Gin X Martian
My code today:
list.row.each(function(row)
{
for(x = 0; x < aNames.length; x++)
{
found = true;
if(row.Name.toLowerCase().indexOf(aNames[x]) < 0)
found = false;
if(!found)
break;
}
if(found)
filterlist.row[filterlist.row.length] = row;
});
Thanks for the help! My code today is working, but seems to be slow
and maybe inefficient.
Karl..
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---