var selectListShips = {
dropdownAutoWidth: true,
width: '200px',
//minimumInputLength: 1,
ajax: { url: 'wwv_flow.show',
dataType: 'json',
quietMillis: 500,
data: function (term, page) {
return {
p_request : 'APPLICATION_PROCESS=GET_SHIPS_SELECT2',
p_flow_id : $v('pFlowId'),
p_flow_step_id : $v('pFlowStepId'),
p_instance : $v('pInstance'),
x01 : $(this).parent().parent().find('select[name="f03"]').val()
};
},
results: function (data, page) {
return { results: data.row };
},
cache: true
}, // end ajax call
initSelection: function(element, callback) {
var id = element.val();
if (id) {
var data = {id: element.val(), text: shipDic[id]};
callback(data);
}
}, // end init selection
placeholder: " ",
allowClear: true};
DECLARE
l_cursor sys_refcursor;
l_param VARCHAR2 (40) := apex_application.g_x01;
l_row_id VARCHAR2 (40) := apex_application.g_x02;
l_selected_value varchar2 (200);
BEGIN
open l_cursor for select item_shtname "text"
, item_code "id"
from lgms_lov_v
where upper(lov_code) = 'SHIPS'
and attribute3 = l_param -- 'PCL'
order by 1;
apex_json.open_object;
apex_json. write('results', l_cursor);
apex_json.close_object;
END;
declare
l_need_comma boolean := false;
begin
-- Create "dictionary" arrays:
-- deptDic for Departments
-- They are used for the populating the Select2 items
-- that already have codes and avoid an extra AJAX call for each one.
sys.htp.p('<script>');
sys.htp.prn('var shipDic={');
for d in (
select d.item_shtname as description,
d.item_code as code
from lgms_lov_v d
where upper(lov_code) = 'SHIPS'
order by 1
)
loop
if l_need_comma then
sys.htp.prn(',');
else
l_need_comma := true;
end if;
sys.htp.prn(d.code || ':"' || replace(d.description, '"','\"') || '"');
end loop;
sys.htp.p('};');
sys.htp.p('</script>');
end;