Replies: 1 comment 1 reply
-
Hello @Neosm, In your case, you'll need a custom const autoCompleteJS = new autoComplete({
data: {
src: [
{ user: "User 1" },
{ user: "User 2" },
{ article: "Article 1" },
{ article: "Article 2" },
{ user: "User 3" },
{ article: "Article 3" },
{ user: "User 4" },
{ user: "User 5" },
],
cache: true,
},
searchEngine: (query, record) => {
query = query.toLowerCase();
const user = record.user;
const article = record.article;
if (user && user.toLowerCase().includes(query)) {
return user;
}
if (article && article.toLowerCase().includes(query)) {
return article;
}
return false;
},
} Please, try it and let me know how it goes. :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm sorry for my English, i'm French.
I have a problem, I want an autocomplete from 2 data's sources (User and Articles).
If I use an only key like this :
{name: user 1}, {name: user 2}, {name: article 1}
... I can search but the key is "Name" I don't want that.If I do
{user : user 1, article : article 1}, {user : user 2, article : article 2}, {user : user 3 article : article 3}, {user : user 4}, {user : user 5}
I have Cannot read property 'toString' of undefined errorI want something like
{user : user 1}, {user : user 2}, {article : article 1}, {article : article 2}, {user : user 3}, {article : article 3}, {user : user 4}, {user : user 5}
To see values and keys on my search form. But I have an Cannot read property 'toString' of undefined error
How can I do this without error?
Beta Was this translation helpful? Give feedback.
All reactions