question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use 'Selectize' with multiselect array with emuns

See original GitHub issue

Is it possible to use Selectize with array with predefined values (enum), something like this:

             tags: {
                type: "array",
                format: "select",
                uniqueItems: true,
                items: {
                  type: "string",
                  enum: ["bold","italic","smallcaps"]
                }
              },

Using code above with Selectize, json-editor renders default browser’s select box, not Selectize box.

but when i remove:

enum: ["bold","italic","smallcaps"]

json-editor renders Selectize element, as expected.

So it there ability to use Selectize with array with predefined values?

Thanks for such a great lib!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
miket-devcommented, Jun 4, 2019

It does not documented, as a workaround you could move enum property into parent object as following:

             tags: {
                type: "array",
                format: "select",
                uniqueItems: true,
                enum: ["bold","italic","smallcaps"],
                items: {
                  type: "string"
                }
              },

It would be rendered with selectize and treated enum as default. Anyway, according to docs enum property should be in items and when enabling selectize it is expected to render all select control with selectize. I will take a closer look.

0reactions
pmk65commented, Jun 4, 2019

@mneofit You seem to be using Selectize and have a good grasp on how JSON-Editor works, so maybe this is something you could take a look at? (If you got the time 😁)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multi select drop down list for enum - Stack Overflow
I solved it on the client side with the following behaviour: Get method: [HttpGet] public ActionResult ValueAction(ValueEnum result) { //irrelevant code ...
Read more >
Select Field - Alpaca Forms
Defines an f(a,b) sort function for the array of enumerated values [{text, value}]. This is used to sort enum and optionLabels as well...
Read more >
Selectize
Selectize is the hybrid of a textbox and <select> box. It's jQuery-based and it's useful for tagging, contact lists, country selectors, and so...
Read more >
json-editor/README.md at master - GitHub
enum_titles - An array of display values to use for select box options in the same order as defined with the enum keyword....
Read more >
select_tag (ActionView::Helpers::FormTagHelper) - APIdock
option_tags is a string containing the option tags for the select box. Options. :multiple - If set to true, the selection will allow...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found