$e["on_insert"] = array("add_master", null, true);
$e["on_delete"] = array("delete_master", null, true);
$grid->set_events($e);
function add_master(&$data)
{
//$id = intval($_GET["rowid"]);
//$comp_id = $_GET["comp_id"];
//$data["params"]["branch_id"] = $id; IT WORKS
$data["params"]["comp_id"] = $_SESSION['comp_id']; IT WORKS
phpgrid_error ($data["params"]["branch_name"]);IT WORKS
}
function delete_master(&$data)
{
$check_sql = "SELECT count(*) as c from employee where branch_id = '".$data["params"]["id"]."'";
$rs = mysql_fetch_assoc(mysql_query($check_sql));
//if ($rs["c"] > 0)
// phpgrid_error("This branch can not be deleted as it has employees with it");
phpgrid_error ($data["params"]["branch_name"]); IT SHOWS BLANK !! wHY
I need to get this value in the last line on delete function. but it shows blank instead of value. What is wrong with the code?
Current api only passes ROW ID in on_delete callback function.
If you need other data, you can run another select query and fetch the recordset using passed row id.
Thanks for your response.
I hope this rowid is for the same grid for which we are using on delete function?
I tried to get rowid on delete but it shows blank.
function delete_master(&$data)
{
phpgrid_error (intval($_GET[rowid]));
}
Suppose, you first column name is 'client_id' then you will use $data["client_id"] in on_delete handler to get row id.
Row id is first column value.