nbuytaert1 / apex-select2

Select lists in Oracle APEX as they should be
https://apex.oracle.com/pls/apex/f?p=64237:20
GNU General Public License v2.0
56 stars 18 forks source link

Setting Item Value from PL/SQL #77

Closed pettinger closed 7 years ago

pettinger commented 7 years ago

Hi, i have an issue when setting the ITEM Value out of an PL/SQL Procedure using APEX_UTIL.SET_SESSION_STATE('P35_ARBEITSPLATZGRUPPE',coalesce(rTmpStechung.STNRMASCH, rTmpStechung)). The value is shown in session state of the item, but the lov does not select the according row. it stays empty. but as soon as you drop down the list, the correct row is selected. select2

as soon as i switch the item type from select2(plugin) to the standard Select List, setting the item works like charm. any clue what might go wrong ?

regards peter

nbuytaert1 commented 7 years ago

Hi Peter,

Are you executing APEX_UTIL.SET_SESSION_STATE as part of a PL/SQL dynamic action? In that case, you'll have to add an Execute JavaScript Code action after the Execute PL/SQL Code action. Add the following JavaScript code to actually set the item's value in the Select2 item.

$("#P35_ARBEITSPLATZGRUPPE").trigger("change");

Also, it looks like you are using an old version of the Select2 APEX plugin. Is it possible for you to upgrade to the latest version (3.0.3)? There's a higher chance of bugs in old versions of the plugin.

Hope that helps, Nick

pettinger commented 7 years ago

Thanks for the reply. Adding the Javascript action did the trick. But to make it work, i had to change the "wait for result" property of the pl/sql action to "yes". took me some time to figure that one out.

Peter