Good Morning, Abu.
I have a problem with an “on_after_update” event.
I have this 2 functions:
function after_update($data){
global $g;
$Terminal = $data[“Terminal”];
$Bonos = $data[“params”][“Bonos”];
$Sql = “UPDATE Datos SET BonosPrev = $Bonos where Terminal = ‘$Terminal'”;
$result = $g->execute_query($Sql);
}
function update_terminal($data)
{
global $g;
global $username;
$Terminal = $data[“Terminal”];
$Establecimiento = $data[“params”][“Establecimiento”];
$Bonos = $data[“params”][“Bonos”];
$BonosPrev = $data[“params”][“BonosPrev”];
$Sql = “INSERT INTO journal (Fecha, Terminal,Establecimiento,Operacion, Descripcion,Importe,Notes) VALUES (‘”.date(‘Y-m-d H:i:s’).”‘,’$Terminal’, ‘$Establecimiento’,’Bonos Añadidos $Bonos ($BonosPrev)’,’$Bonos Bonos’,0,’Usuario : $username’)”;
$result = $g->execute_query($Sql);
}
all works fine, but the grid dont refresh automatically on after update event , i have to press f5 or reload button.
Is any way to “push” reload button from code? or call refresh grid?
i know that after update, the grid refresh the content, and i tryed to put the
$Sql = “UPDATE Datos SET BonosPrev = $Bonos where Terminal = ‘$Terminal'”;
$result = $g->execute_query($Sql);
at the end of the update function, but it dosn´t work.
Any help?
thank you very much for your support.
Hi,
You need to put following in the end of after_update event handler.
$id = data["Terminal"]
$res = array("id" => $id, "success" => true)
echo json_encode($res);