Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

How to pass selected option in JSON data? #57

Closed
sunnykasera3107 opened this issue Oct 3, 2018 · 4 comments
Closed

How to pass selected option in JSON data? #57

sunnykasera3107 opened this issue Oct 3, 2018 · 4 comments

Comments

@sunnykasera3107
Copy link

Hi there,

I am using the tokenize2 plugin for multiselection and autocomplete. And it is a perfect plugin.
But I am facing an issue with that, I don't know how to pass selected option attribute with JSON data source. So that when user load page he may see some options already selected.

Just FYI, I am using data source as URL, not select type.

Many thanks in advance.
Sunny

@dragonofmercy
Copy link
Owner

Hi the data source is only used when searching value, if you have to display selected option on load, just put "selected" attribute to options.

Have a look to this issue #9

@sunnykasera3107
Copy link
Author

sunnykasera3107 commented Oct 4, 2018 via email

@dragonofmercy
Copy link
Owner

You have to fetch your json on load manually and for each item, use this method

$('.tokenize-demo').tokenize2().trigger('tokenize:tokens:add', ['token value', 'token display text', true]);

@sunnykasera3107
Copy link
Author

sunnykasera3107 commented Oct 4, 2018 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants