On_delete not working

QuestionsOn_delete not working
Greg asked 8 years ago

Hi,

I have recently upgraded to v2.0 of the grid and I am trying to use the on_delete function to do a soft-delete instead (i.e., an update) when clicked.

When I run this code and click delete, the delete box just keeps showing and doesn't do anything – it just hangs.

Here is the code.

//Events
$e["on_delete"] = array("delete_deactivate", null, false);

function delete_deactivate($data)
{
print_r();
global $grid;
$DeactiveQuery = "UPDATE schedule SET state ='I' WHERE scheduleid = {$data["scheduleid"]}";
$grid->execute_query($DeactiveQuery);
}

$g->set_events($e);

Where scheduleid is the name of the field in the database.

Thank you – Greg.

1 Answers
Abu Ghufran answered 8 years ago

Please check debugger console (f12) to javascript errors.
Looks like some text is printed in ajax call response causing JSON to break.

print_r(); should also be removed.

Your Answer

9 + 0 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?