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:
- 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.
- 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.
$("select").val("1").trigger("change"); // instead of $("select").select2("val", "1");
Also the enable method has been deprecated.
$("select").prop("disabled", true); // instead of $("select").enable(false);
Amazing job!! I cannot even explain how great it is!
LikeLike
why is this not working in tabular form?
LikeLike
You can’t use item type plugins in tabular forms. This is actually a limitation of the tabular form component.
It will be possible in APEX 5.1 to use item type plugins in the new Interactive Grid component.
In the meantime, you might find the following article helpful.
http://rimblas.com/blog/2016/01/using-select2-on-apex-tabular-forms/
LikeLike
Unable to find sql file in select2 plugin for tabular form.
And I want to auto insert my row on the selection from select list element in tabular form..do you have any idea or suggestion for me?
LikeLike
Hello Nick,
this plugin is not showing for a field in Interactive grid. i am using apex 5.1.1.
when you click an item other than the Interactive Grid, it is showing.
how could i make it working in interactive grid?
Thank you
LikeLike
Hi Muhammad,
I’m working on IG support for the Select2 APEX plugin. I’ll release an updated version of the plugin by the end of this week.
Keep an eye on the following GitHub issue for further updates:
https://github.com/nbuytaert1/apex-select2/issues/73
Nick
LikeLike
When using Select2(plug in) in an interactive grid in single selection mode, selection jumps to the lower left corner when typing in search bar.
As mentioned this only happens when using the single selection mode.
Here’s a screenshot on how it looks when you type in the search bar using the sample application:
LikeLike
Hi Phat,
I’m working on IG support for the Select2 APEX plugin. I’ll release an updated version of the plugin by the end of this week.
Keep an eye on the following GitHub issue for further updates:
https://github.com/nbuytaert1/apex-select2/issues/73
Nick
LikeLike
LikeLike
Hey Phat,
I can’t see your screenshot, but I know what you’re talking about. My demo application on apex.oracle.com has the same problem:
https://apex.oracle.com/pls/apex/f?p=47839:20
I haven’t found a solution yet. I’ll try to come up with a fix in one of the next weeks.
I’ll keep you posted,
Nick
LikeLike
Hi Nick , Did you fix this bug ? I really wanna use this in my module . Pls fix this ASAP. Thank Nick
LikeLike
Not yet. It’s not something easy to fix I’m afraid. I’ll keep you posted.
LikeLike
Excellent work Nick, I intend to replace my old select2 plugins by yours, especially with lazy-loading management which is a major asset. I downloaded and try this one and this one works fine. I have only one comment about this one is that the function apex.item (pNd) .setFocus () does not work, I also had this problem with my old selec2, I solved this one with a javascript function: select2FocusApexItem: function (apexItem) {
Var idSelcItem = ‘#’ + apexItem;
$ (IdSelcItem) .select2 (‘focus’);
Is it possible for you to settle this thing … I am not an expert js …. But overriding the focus would be possible?
Thanks
LikeLike
It is one of the great plugin of Oracle Apex. Thank you so much for your efforts.
LikeLiked by 1 person
Hi Nick,
I used the Select2(plug in) and i have a prob with the dynamic action show/hide
the js function does’t work from the first time
any idea please?
LikeLike
Hi Nick,
thanks for the plugin – I like it a lot.
however, I have one question: I would like to set the value of a field with a dynamic action … this works as long as there is only 1 value – if I have multiple values it does not work.
Any suggestion ?
Thanks
Dirk
LikeLike
Hi Dirk,
Create an “Execute JavaScript Code” action and do something like this:
More info: https://github.com/nbuytaert1/apex-select2/issues/76
Hope that helps,
Nick
LikeLike
Thanks – works like a charm
LikeLiked by 1 person