Get data parameters in custom events

QuestionsGet data parameters in custom events
Pedro Couto asked 4 years ago

Good Afternoon, Abu.

I have a little problem with an event in a grid, i can get only the editable fields, and the firt col data, this is the code.

$e[“on_update”] = array(“update_terminal”, null, true);

$g->set_events($e);

 

function update_terminal($data)
{
$term = $data[“Terminal”];
$est = $data[“Establecimiento”];
$bon = $data[“params”][“Bonos”];
$fec = $data[“Fecha”];
global $g;$str = “INSERT INTO journal (Fecha, Terminal,Establecimiento, Descripcion,Notes) VALUES (‘”.date(‘Y-m-d H:i:s’).”‘,’$term’, ‘$est’,’Corregidos Bonos : $bon ‘,’$fec’)”;
$g->execute_query($str);
}

I can get The filed Bonos, beceause is the one i edit, ican get the Terminal, beceause is the first field in the grid, but, how is possible to get the others fields of the selected row if they are not editables?

Thank you very much for your support.

 

Best regards.

1 Answers
Abu answered 4 years ago

Only editable fields are currently posted back to server. You can put debug function to see the posted $data array.

function update_terminal($data)
{ phpgrid_error($data);
// …
}

What you can do is to execute a sql query and fetch row data from database using first column (id). e.g.

global $g;
$rs = $g->get_one(“….. WHERE ID = $id”);

Your Answer

15 + 0 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?