Giter VIP home page Giter VIP logo

Comments (8)

schmunk42 avatar schmunk42 commented on May 27, 2024

Here's a select2 example:

If you use tags-style you need type: array, I think ... simple example

from json-editor.

RelicOfTesla avatar RelicOfTesla commented on May 27, 2024

@schmunk42 , In your example same console error output

{
  "title": "Person",
  "type": "object",
  "properties": {
    "tags": {
      "type": "array",
      "format": "select2",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": [
          "bold",
          "italic",
          "smallcaps"
        ]
      }
    }
  }
}
jsoneditor.getEditor('root.tags').setValue(['dddddd1'])
// OR
jsoneditor.getEditor('root.tags').setValue('dddddd2')  // same error
// OR
jsoneditor.setValue({'tags':'fffffff3'}) // same error
// OR
jsoneditor.setValue({'tags':['fffffff4'] }) // same error
jsoneditor.min.js:8 Uncaught TypeError: this.input.appendChild(...).trigger is not a function
    at a.value (jsoneditor.min.js:8:145371)
    at a.value (jsoneditor.min.js:8:144911)
    at a.value (jsoneditor.min.js:8:143747)
    at <anonymous>:1:35

from json-editor.

schmunk42 avatar schmunk42 commented on May 27, 2024

It shows the error you mentioned if you use a non-exisiting value, but with an existing value it looks good to me:
Bildschirmfoto vom 2024-04-04 15-14-54

from json-editor.

RelicOfTesla avatar RelicOfTesla commented on May 27, 2024

I know there's no problem using existing values... I was reporting an BUG when setvalue a non-existent value ...
BTW, origin Select2 supports non-existent value when using tags=true.
@schmunk42

from json-editor.

schmunk42 avatar schmunk42 commented on May 27, 2024

Funny thing is, in the example you can enter a custom value, click twice ... first click show the error, second click adds the value.

However, a validation error is still triggered because the value is not contained in the enumeration list.

I think you'd need a custom editor which saves the values as comma-separated string.

from json-editor.

RelicOfTesla avatar RelicOfTesla commented on May 27, 2024

i already known :( .......
source code not quote $ the appendChild(xxx).trigger(xx)...

this.input.appendChild(new Option(sanitized, sanitized, false, false)).trigger('change')

else this.input.appendChild(new Option(value, value, false, false)).trigger('change')

fix to

// this.input.appendChild(new Option(sanitized, sanitized, false, false)).trigger('change') 
 $(this.input.appendChild(new Option(sanitized, sanitized, false, false))).trigger('change') 

@schmunk42 please fix it.

from json-editor.

schmunk42 avatar schmunk42 commented on May 27, 2024

@germanbisurgi Please have a look and reopen if it's a bug.

from json-editor.

RelicOfTesla avatar RelicOfTesla commented on May 27, 2024

@schmunk42 @germanbisurgi anyone check it?

from json-editor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.