#Set Value
avec #Ajax Callback + #SweetAlert2
Process Ajax Callback PL/SQL
GET_DEPT_INFO
declare
l_location dept.loc%TYPE;
l_no_emp number;
begin
select DEPT.LOC LOC,
count(EMP.EMPNO) EMPNO
into l_location , l_no_emp
from DEPT DEPT,
EMP EMP
where DEPT.DEPTNO = EMP.DEPTNO(+)
and DEPT.DEPTNO = :P22_DEPTNO
group by dept.loc;
apex_json.open_object;
apex_json.write(
p_name= ('LOC'),
p_value = l_location
);
apex_json.write (
p_name = ('EMPNO'),
p_value = l_no_emp
);
apex_json.close_object;
end;
Action dynamique JS code
apex.server.process("GET_DEPT_INFO", {
pageItems: "#P22_DEPTNO"
},
{
success: function(data){
$s("P22_LOCATION",data.LOC);
$s("P22_NO_EMP",data.EMPNO);
}
}
);
Utiliser Sweet Alert 2 pour confirmer
Set Value avec Ajax Callback
const swalWithBootstrapButtons = Swal.mixin({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
})
swalWithBootstrapButtons.fire({
title: 'tu veux valider DA Set Value?',
text: "Tu confirmes cette Action SetValue!",
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Valider!',
cancelButtonText: 'Annuler!',
reverseButtons: true
}).then((result) = {
if (result.isConfirmed) {
apex.da.cancel();
swalWithBootstrapButtons.fire(
'Valider !',
'lโopรฉration SetValue a รฉtรฉ bien exรฉcutรฉ.',
'success'
)
} else if (
/* Read more about handling dismissals below */
result.dismiss === Swal.DismissReason.cancel
) {
swalWithBootstrapButtons.fire(
'Annuler',
'lโopรฉration SetValue a รฉtรฉ annulรฉ :)',
'error'
)
}
})