Friday, October 27, 2017

Oracle Apex5: Set select 2 values based on paraemt LOV fields

I have a form where I have two LOV, the first is a normal LOV and second LOV is a Select2 plugin field, I would like to set the value of the second LOV based on the first LOV value, here is how to do it:

1. create a change type DA on the first LOV, execute following javascript in the DA:

$('#P_SELECT2').select2('data', { R:$v("P_FIRST_LOV") , D: $v("P_FIRST_LOV")+'/Display value'}); 


2. Here is how to get it cleaned/initilized:

$('#P_SELECT2').val(null).trigger('change');

UPDATE:

New version need to do this way:


 $('#P_ITEM').select2("trigger", "select", { data: { id: $v('P_FIRST_LOV'), text: $v('P_FIRST_LOV')+'/Display value'  }});

No comments:

Post a Comment