This topic is locked

ADD delete button for each row result

5/15/2010 10:49:58 AM
PHPRunner General questions
F
force authorDevClub member

how to add a delete button for each row of the result.

example instead of selecting the row and click delete selected, I'd like to click a button to delete directly in the line that this button.

thanks!

A
ann 5/18/2010

Hi,
to add a delete button for each row proceed to theHTML mode on the Visual Editor tab and add a custom link {$custom_link} to the row.

Then modify the After record processed event

$record["custom_link"] = "<a href=\"TableName_list.php?a=delete&recordid=".$data["Id"]."\">delete</a>";



and Before record processed event

if ($_REQUEST["a"]=="delete"&& $_REQUEST["recordid"])

{

$sql="delete from TableName where Id=".$_REQUEST["recordid"];

CustomQuery($sql);

}
F
force authorDevClub member 5/18/2010



Hi,
to add a delete button for each row proceed to theHTML mode on the Visual Editor tab and add a custom link {$custom_link} to the row.

Then modify the After record processed event

$record["custom_link"] = "<a href=\"TableName_list.php?a=delete&recordid=".$data["Id"]."\">delete</a>";



and Before record processed event

if ($_REQUEST["a"]=="delete"&& $_REQUEST["recordid"])

{

$sql="delete from TableName where Id=".$_REQUEST["recordid"];

CustomQuery($sql);

}



Thanks worked perfectly.

one more question, when I add a new record it only comes with the edit link, it would have some way of making it come already with a link to delete?

A
ann 5/18/2010

Hi,
this task requires a lot of custom coding in the generated files. Unfortunately we don't have a ready to go solution for this.