json-editor icon indicating copy to clipboard operation
json-editor copied to clipboard

Option to disable Select2

Open DJWassink opened this issue 9 years ago • 7 comments

Currently Select2 is completely bugged. Selected item doesn't get set at startup, Neither does the returned json from the editor when you submit the form when another item was set in the Select2 dropdown menu.

Since I am using Select2 for a few other places (menu for example) it would be great if there was a option to disable Select2 for JSON-editor while we can still use Select2 for other things. #227 #225

This fix doesn't seem to work in version 0.7.7? Or maybe it is because I set the value's in the startVal in the schema. #210

DJWassink avatar Aug 22 '14 14:08 DJWassink

I just did a big cleanup of the Select2 integration code and fixed a bunch of bugs. Can you see if you still notice any problems in 0.7.9?

I still want to have an option to disable Select2, but I'd like a more general solution that works for the other 3rd party integrations as well (ace, SCEditor, EpicEditor). Maybe using the JSONEditor.plugins object somehow. I'd like to think about it some more.

jdorn avatar Sep 01 '14 03:09 jdorn

An issue that has now arisen is that the select2 v. 4 syntax is subtly different from the select2 v. 3 syntax, so version detection will need to take place. It'd be good if this PR could be merged so that we could think about this new problem as a separate issue.

mscuthbert avatar Jan 27 '15 01:01 mscuthbert

Using select2 v4 and the value fails to update for me as well

samvaughton avatar Apr 13 '15 11:04 samvaughton

+1 for adding an option to disable Select2

Or better don't use it by default and add an option to enable it.

chumakoff avatar Sep 05 '16 10:09 chumakoff

+1 Please add the option to disable select2, In my case I have to use select2 for another view above the jsoneditor view. Hence, I have to find the way to disable select2 in the jsoneditor view.

programoo avatar Jun 22 '17 03:06 programoo

I ran into similar issues since I want to use select2 elsewhere on the page, but found that the JSONEditor select2 support didn't populate enum fields that were provided by setValue. As a workaround I did this to prevent JSONEditor from using it:

// save a reference to select2
var select2 = window.jQuery.fn.select2;
// clear it from the jQuery functions so JSONEditor doesn't see it
window.jQuery.fn.select2 = null;
// invoke it directly on the jQuery results where I want it enabled
select2.call($('#my-select-list'))

mgood avatar Apr 19 '18 21:04 mgood

https://github.com/jdorn/json-editor#deprecation-notice https://github.com/json-editor/json-editor/issues/44

schmunk42 avatar Apr 20 '18 09:04 schmunk42