Skip to Main Content

how to dynamically display/hide apex_item using dynamic actions

MehabubRSheikhJan 5 2021

Hi
I have a classic report which uses the below query
elect apex_item.checkbox2(
p_idx => 1,
p_value => pre_pat.name,
p_item_id => 'P82_INCLUDE',
p_item_label => 'Select/Unselect' || pre_pat.name) include, pre.name surgery_name,
apex_item.text(p_idx=>3,
p_value => pre_pat.SURGERY_DONE_ON,
p_size =>5,
p_maxlength=>5,
p_attributes => 'class="surgeryBefore"') before,
APEX_ITEM.SELECT_LIST_FROM_LOV(p_idx =>5,
p_value => pre_pat.TIME_UOM,
p_lov =>'MED_UOMS',
p_show_null => 'YES',
p_null_text => '- Select -',
p_attributes => 'class="surgeryTimeFrame"') time_frame,
APEX_ITEM.DATE_POPUP2(
p_idx =>7,
p_value =>DATE_SURGERY_DONE,
p_size => 10,
p_navigation_list_for =>'MONTH_AND_YEAR',
p_year_range => a.year,
p_attributes => 'class="surgeryDate"') surgery_date,
APEX_ITEM.TEXTAREA(
p_idx => 9,
p_value => pre_pat.description,
p_rows => 2,
p_cols =>20
) description
from SURGERY_DEFN_ALL pre
,PATIENT_SURGERY_ALL pre_pat,
(select (extract(YEAR from SYSDATE)-80)||':'||extract(year from sysdate) year from dual) a
where pre.name =pre_pat.name(+);
Now I am trying to hide columns before and time_frame if the user selects surgery_date using dynamic action with action as Execute Javascript. I have the following Javascript to hide it.

var l_surgery_date = $(this.triggeringElement);
var l_surgery_time = $(this.triggeringElement).closest('tr').find('.surgeryTimeFrame');
var l_surgery_duration = $(this.triggeringElement).closest('tr').find('.surgeryBefore');
console.log(l_surgery_date.val());
if (l_surgery_date.val().length>0)
{

l_surgery_duration.style.display ='none';
l_surgery_time.style.display = "none;
}
else{
console.log(l_surgery_date);
}
But it's not working. I am new to this world. If you can help me that will be really great.

Regards
Mehabub

Comments
Post Details
Added on Jan 5 2021
2 comments
22 views