Query -> APEX_ITEM.hidden (p_idx => 1
, p_value => ID) ||
APEX_ITEM.CHECKBOX2(p_idx => 2,
p_value => 'S') SELECCION_ID
JavaScript + AjaxCallBack ->
var elem = this.triggeringElement;
var estaMarcado = $(elem).is(':checked');
var seqId = $(elem).parent().find("input[name='f01']").val();
apex.server.process("Ingresar_Coleccion",
{ x01: seqId
, x02: estaMarcado
}
, {success: function(pdata){
console.log(pdata.mensaje);
// Refrescar la región de colecciones
apex.region("coleccion").refresh();
}
}
);
AjaxCallBack ->
declare
v_seq_id number;
begin
if not apex_collection.collection_exists('MARCAR_ID') then
apex_collection.create_collection('MARCAR_ID');
end if;
IF apex_application.g_x02 = 'true' THEN
APEX_COLLECTION.ADD_MEMBER(
p_collection_name => 'MARCAR_ID',
p_c001 => apex_application.g_x01
);
apex_json.open_object;
apex_json.write(p_name => 'mensaje', p_value=> 'Ingresado a la coleccion correctamente');
apex_json.close_object;
else
begin
Select seq_id
into v_seq_id
from apex_collections
where collection_name = 'MARCAR_ID'
and c001 = apex_application.g_x01;
end;
APEX_COLLECTION.DELETE_MEMBER(
p_collection_name => 'MARCAR_ID',
p_seq => v_seq_id);
apex_json.open_object;
apex_json.write(p_name => 'mensaje', p_value=> 'Se elimino el miembro de la coleccion correctamente');
apex_json.close_object;
End if;
exception
when others then
apex_json.open_object;
apex_json.write(p_name => 'mensaje', p_value=> 'Error en la coleccion');
apex_json.close_object;
end;