After a bit of a delay, I have finally released version 3.0 of the Select2 APEX plugin. This new version is based on the very latest version of the Select2 jQuery plugin (v4.0.3 on the moment of writing). Version 4.0 of the jQuery plugin doesn’t include any new exciting features, but instead focuses on the technical core to keep Select2 extensible and future-proof. You can read the release notes of the Select2 jQuery plugin v4.0 here.

The 4.0 release of Select2 is the result of three years of working on the code base and watching where it needs to go. At the core, it is a full rewrite that addresses many of the extensibility and usability problems that could not be addressed in previous versions.

It has been a challenging exercise to incorporate the latest version of Select2 into the APEX plugin. Getting the basic functionality to work again was pretty easy. However, I had quite some work with the more advanced features such as tagging, drag and drop sorting, lazy loading, etc.

The main reason I’m writing this article is because of the following important notice: version 3.0 of the Select2 APEX plugin is not fully backwards compatible with older versions. I tried my best, but the impact of the changes within the jQuery plugin was simply too much. Here’s a list of changes you have to keep in mind when upgrading to version 3.0 of the Select2 APEX plugin.

Increased the minimum required APEX version to 4.2

The minimum required APEX version for the Select2 APEX plugin was 4.1. I have decided to increase the minimum required version to APEX 4.2, mainly because of two reasons:

  1. APEX 4.1 has a low user base. Of course, you can still use version 2.6.4 of the Select2 APEX plugin in APEX 4.1.
  2. The plugin framework is considerably better in APEX 4.2 compared to version 4.1.
Removed the Return Value Based On attribute

This attribute was only applicable in tagging mode. It let you specify whether you want the display or return column as return value. This attribute has become obsolete since now the LOV definition is used as source for the display and return value.

Removed the Source Value Separator attribute

The separator attribute has been removed from the jQuery plugin, so I had no other choice than removing it from the APEX plugin as well.

Changes to translation messages in Component Settings
  • Added an extra translation message: Error Loading Message.
  • Removed the #TERM# substitution variable from the No Results Found Message.
  • Added the #REMAININGCHARS# substitution variable to the Input Too Short Message.
  • Removed the #PAGENUMBER# substitution variable from the Loading More Results Message.
Changes to the plugin custom events

The Select2 APEX plugin includes custom events that are available for use in dynamic actions. Some events have been removed, while others have been added. Please take a look at the demo page for a list of available events.

Deprecated JavaScript methods

The val method has been deprecated and will be removed in Select2 4.1. You should directly call .val on the underlying <select> element instead.

// instead of $("select").select2("val", "1");

Also the enable method has been deprecated.

$("select").prop("disabled", true);
// instead of $("select").enable(false);