$col=array();
$col[“title”] = “ModuleID”;
$col[“name”] = “ModuleID”;
$col[“hidden”] = true;
$cols[]=$col;
$e[“on_delete”] = array(“delete_CusMod”, null, false);
$grid->set_events($e);
function delete_CusMod($data)
{
$sql = “DELETE FROM MMS_CustomModules WHERE ModuleID='”.$data[‘params’][‘ModuleID’].”‘ AND CID='”. $_SESSION[‘CID’] .”‘”;
$result = SQLQuery($sql);
}
Why is $data allways empty?
I have figured out that data[‘param’][‘FieldName’] is not working with “on_delete”
It must be $data[‘FieldName’], [‘param’] is not supported afaiks.
Hello, review your query: https://gist.github.com/colegiosdigitales/14aa9cb1fcc742e3c82874fe5861aa95
It’s necessary Table Col Name for query
Regards!
You can always debug $data passed to callbacks using:
function delete_CusMod($data)
{
phpgrid_error($data);
}
It will show $data array as error box when you delete.