Hello all (possibly Hello Nick),
Abstract:
When I use Select2 uninitialized (= with start value NULL) and select a value related items are not refreshed on "Change [Select2]" event.
If the Select2 item has a start value != NULL related items get refreshed after new selection.
Select2 plugin with version 3 and Apex 4.2
The whole story:
My intention is to select a single department (with list P260_DEP) and refresh other items depending on the selection.
One of these items is a "display only" text field to show the number of employes (P260_EMP_CNT), another is a cascading list (P260_EMP), displayed when P260_DEP is not NULL.
Furthermore, I set an application item (G_DEP) to save the selected departement for use in other pages. G_DEP is used to initialize the PXXX_DEP lists on pages XXX.
When I use a standard drop-down list and do a submit everything is fine. But now, for usability reasons I want to refactor.
With Select2 I try to achieve the update with a dynamic action on "Change [Select2]"
- PL/SQL: apex_util.set_session_state('G_DEP', :P260_DEP);
- Refresh: P260_DEP_CNT
- Refresh: P260_EMP
(essentially copied from "Cascading LOV Issue with the Select2 Plug-In", https://community.oracle.com/thread/3609984 Sep 24, 2014)
(I tried set_session_state for P260_DEP as well, but some say it is not necessary when P260_DEP is submitted)
Select2 works fine with auto-complete and everything.
But when I select a department nothing happens if the Select2 item P260_DEP started with value NULL.
Correction! P260_DEP_CNT and P260_EMP are not refreshed. In the session debug window I see that P260_DEP and G_DEP are set correctly but no Refresh of the related items is done.
And "of course": when I select a departement, leave the page and come back again the count in P260_EMP_CNT is correct and P260_EMP is displayed. This is as expected, P260_DEP is initialized by G_DEP and the depending items, hmm, depend.
The great mystery for me is: This problem only happens when G_DEP and the initialized P260_DEP started with NULL. When there was a value everything is OK.
Has anybody any idea? Maybe I'm totally wrong with blaming Select2 and I got my bloody nose because I'm heading in the wrong direction.
Of course, any help will be greatly appreciated
Norbert
[edited for clarification: Select2 item is NULL before selection, NOT NULL afterwards (maybe I was not clear on this point, it was late yesterday]