Can we disable select2 field?
Can we disable select2 field?
I would like to disable select2 (version 4.0.1 or 4.0.2) field in editor. I tried this
editor.on( 'initEdit', function () {editor.disable('select2_field');} )
and got an error
select2.js:5530 Uncaught TypeError: Cannot read property 'apply' of undefined
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I have found the workaround.
Thanks for noting that. I'll add the required methods and post back here when done.
Allan
Actually, the plug-in does have the required methods, but they were using the Select2 3.x API rather than the 4.x API which has changed. The
enable
anddisable
methods for the plug-in should be:I've updated the plug-in page with this change now.
Thanks for flagging it up!
Regards,
Allan
I have updated the plugin and disabled the field like this
and it works!
Thanks :)