The delete function does not know the primary key.
This is the primary key definition, made so as to be invisible in the grid, but enabled in the edit / add form:
$col = array();
$col["title"] = "ID";
$col["name"] = "IDClienteFornitore";
$col["width"] = "5";
$col["hidden"] = true;
$col["editable"] = true;
$col["editrules"] = array("edithidden"=>false); $col["align"] = "right"; $col["export"] = $grantcol;
$cols[] = $col;
this is the custom update SQL:
UPDATE hmr_own_clienti_fornitori SET … WHERE IDClienteFornitore = {$data["params"]["IDClienteFornitore"]} AND IDAzienda = " . $IDAzienda
this works!
this is the custom delete SQL:
DELETE FROM hmr_own_clienti_fornitori WHERE IDClienteFornitore = {$data["params"]["IDClienteFornitore"]} AND IDAzienda = " . $IDAzienda;
this doesn't work!
Why?
Thanks in advance
Regards
Massimo Gagliardi
The ID can be accessed by $data["IDClienteFornitore"].
Reference: demos/editing/custom-events.php
function delete_client($data)
{
print_r($data);
/*
These comments are just to show the input param format
$data => Array
(
[client_id] => 2
)
*/
}
I understand but there isn't a possibility to use the default deleting function without a custom function?
An append to my last:
$data["IDClienteFornitore"] shows the number row of the grid not the field's content; consequence isn't valid to delete a record
You just need to comment on_delete event in grid config. After that it will work with normal delete.
I emailed you a fix for row-number & id issue