Sunday, October 12, 2014

Workaround for ADF 12c Choice List Blank Selection Issue

I would like to share a workaround for Choice List component in ADF 12c. There is specific issue, related to blank selection - as soon as user selects blank selection in the choice list, it starts to invoke value change listener for that list, each time when any other element is selected in the table. This is quite annoying and could lead to unexpected results, especially if you depend on logic implemented in value change listener.

Workaround is implemented in the sample application - ADFChoiceList12cApp.zip. We should take a look first, how it works without workaround applied. Imagine you have a table and one of the columns implements a choice list. Go and select a blank selection for a couple of rows:


Navigate between rows, do couple of clicks - you should notice in the log information about value change listener invoked. This is quite strange, it should not call value change listener each time, just only first time after selection was changed in the list:


Choice list UI component is set with AutoSubmit=true and assigned with value change listener method:


Choice list is configured with blank item selection in ADF BC:


To apply workaround, go and uncheck blank item selection in ADF BC, make sure checkbox for 'Include No Selection Item' is unchecked:


On UI side, provide any value for UnselectedLabel property of the choice list component, this will generate property in the source (alternatively you could just type it manually directly in the source):


Make sure UnselectedLabel property is set to be blank, this will generate blank item on the runtime (it works much better than the one enabled from ADF BC):


User could navigate through the table, there will be no value change listener triggered anymore (besides one time, when value was actually changed):


Exciting as usual - new features and new bugs :)

3 comments:

  1. i've opened SR for a scenario that includes 2 dependent LOVs and it behaves as you blogged.
    bug number 19911286 - ADF 12C: LOV VALUECHANGELISTENER FIRED UNEXPECTEDLY

    ReplyDelete
  2. Hi Andrejus,
    in this solution default selected value is still the first value from the LOV VO. is there any work around for getting NO_selection as default as well.
    Thanks
    Navpreet

    ReplyDelete