I am using the Eyesis Data Grid Control (http://www.phpclasses.org/package/4951-PHP-Display-data-from-a-database-in-a-sortable-table.html) and would like to add the Delete function as shown in Example 3 (http://www.phpclasses.org/browse/file/25088.html).

The line in the sample code where this is done is:
$x->addStandardControl(EyeDataGrid::STDCTRL_DELETE, "alert('Deleting %Id%')");

How do I change the "alert('Deleting %Id%')" to either a function that deletes the record or a call to another page that does the deleting?

I have tried
$x->addStandardControl(EyeDataGrid::STDCTRL_DELETE, mysql_query(DELETE FROM customer WHERE ID='$ID');
and
$x->addStandardControl(EyeDataGrid::STDCTRL_DELETE, delete_one_record.php);

but both do not work. The grid does not even display using either of the above two lines.

Thanks in advanced.

Recommended Answers

All 3 Replies

In this
$x->addStandardControl(EyeDataGrid::STDCTRL_DELETE, "alert('Deleting %Id%')");
the second parameter is a javascript code.

Try to make a javascript function which call your delete_one_record.php file using Ajax, give this function like a second parameter.

I would suggest w3schools for the solution of your question.

Thanks albucurus. You led me down the right path and it is working now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.