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

Cascading LOV Issue #56

Open croHamster opened 8 years ago

croHamster commented 8 years ago

Hi,

I found this one of the most useful APEX Plugin.

In the meanwhile I found that select2 is working with cascading LOV, but not in one situation: if you have a child LOV that shows all values when parent LOV hasn't a selection (select name, id from child where :parent_id is null or parent_id = :parent_id) and you make a parent selection, the child LOV is showing correct entries. But if you then clear the parent LOV by clicking the 'x' mark at the end of the selected element, the child isn't showing anything (should again show all entries).

Please check this issue. TIA, Hrvoje

nbuytaert1 commented 8 years ago

That seems to be a problem indeed. I'll see if I can find a solution for this.

glebovpavel commented 8 years ago

This problem should be solved in my pull request

croHamster can you please take a look, that there everything works?

croHamster commented 8 years ago

Sure, I can test it, but need input of how to download the pull request so I can install it on my test APEX 5 environment?

croHamster commented 8 years ago

I managed to import the pull request and have tested it. There was also my mistake that I was not using the "Optimize Refresh" correctly (must be set to "No" when using null values that return entries).

The official release works fine with 2 cascading LOV's, but not with 3. The pull request version works fine both with 2 and with 3 cascading LOV's.

Thank you both. Looking forward of merging the changes into the official release.

croHamster commented 8 years ago

Hi Pavel,

I did some more tests and can confirm what i wrote in my previous post - your version works even with 3 levels of cascading LOV's. But there is one behaviour in your version that work's different than in standard select and in select2 official release: when you clear (select null) in parent LOV, the child LOV's selection stays. Standard behaviour is that it is also cleared (nulled).

This can be also a feature, but I think it should eventually be possible to set it up through some option (setting).

glebovpavel commented 8 years ago

Hi Hrvoje, Are you set "Display extra values" on child LOV's to "No"? You can see sample App on https://apex.oracle.com/pls/apex/f?p=65254:1

Sources of attached apps are f65254.zip

croHamster commented 8 years ago

Yes, I have "Display Extra Values" -> No, and "Display Null Value" -> Yes.

The difference is that you show no values in the child when parent is null, and I have all child values when parent is null (this is done with the SQL statement like: select name, id from child where :parent_id is null or parent_id = :parent_id). If I remove the ":parent_id is null" part, it works like in your example an sets the child to null when parent is cleared.

vincentmorneau commented 7 years ago

+1. It is currently not possible to trigger a child to refresh when the parent was emptied through JavaScript.

Example: apex.item("P1_PARENT_LOV").setValue(""); does not trigger P1_CHILD_LOV to refresh.

vincentmorneau commented 7 years ago

Nevermind. I forgot to set "Optimize Refresh" to "No" too. Works on my end now. The X works too.