Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested array as data source for autoComplete #57

Open
Driaan opened this issue Dec 17, 2017 · 2 comments
Open

Nested array as data source for autoComplete #57

Driaan opened this issue Dec 17, 2017 · 2 comments

Comments

@Driaan
Copy link

Driaan commented Dec 17, 2017

Hi ladies and gents,

This is my situation:
var choices = ['ActionScript', 'AppleScript', 'Asp'];
Above is my data object for autoComplete suggestions, however, I wanted to be able to nest more data within those items (in my case to prevent a second request after selecting an item), so that as soon as the user selects the item, there is already some data to display.
So basically, I would like to render it as such:
return '<div data-json="' + item.data + '" data-text="' + item + '"></div>'
where as my data source would look something like json:
var choices = [{name: 'foo', data 'bar'}, 'AppleScript', 'Asp'];
Thus once selected, in the callback I am able to get the dataAttribute('data-json'), and render a different list without having to wait for another request to the server.

If anyone has any advice, it is greatly appreciated.

@Driaan
Copy link
Author

Driaan commented Dec 17, 2017

It's possible that I am misunderstanding how it works currently, and i'm not sure if this is possible.
If that's the case, I do apologize but would greatly appreciate guidance in this direction.

@Driaan Driaan closed this as completed Dec 17, 2017
@Driaan
Copy link
Author

Driaan commented Dec 17, 2017

Closed by accident, sorry!

@Driaan Driaan reopened this Dec 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant