autocomplete
autocomplete copied to clipboard
Documentation is wrong for filtering objects
The example to filter through an array of objects is wrong. I spent an hour to search how to make it work.
$('#auto1').autocomplete({source:[{
data:[
{id:1, title:"alabama"},
{id:2, title:"alaska"},
{id:3, title:"georgia"},
{id:4, title:"texas"},
{id:6, title:"california"}
],
getTitle:function(item){
return item['title']
},
getValue:function(item){
return item['title']
},
}]})
That doesn't work. The proper way I found is :
$('#auto1').autocomplete(
{
source:[{
data:[
{id:1, title:"alabama"},
{id:2, title:"alaska"},
{id:3, title:"georgia"},
{id:4, title:"texas"},
{id:6, title:"california"}
],
valueKey: 'title'
}]});
Appreciate the frustration, but Ouch, feeling the blame from your tone.
If you'd like to submit as a pull request we can look at getting this in. A little positive encouragement helps too.
Sorry, I know I tend to get frustrated after spending too much time on searching how to do something 😇
I'm not sure what PR I should do, as the example is on your website ?