PHPGrid Event not working

QuestionsPHPGrid Event not working
Rankaj asked 9 years ago

Hi,

I am using below phpgrid events for server validation but its not working.Can you please tell how to check event handler for 'on_insert' & 'on_delete'.

$e["on_insert"] = array("add_client", null, true);
$grid->set_events($e);

Thanks

3 Answers
Rankaj answered 9 years ago

Hello Abu,

Simple 'phpgrid_error' message is also not displaying for 'on_insert'/ 'on_delete' events.

What can be the mistake here below in code.I also changed the last param to false/true for both cases.But didn't work.

$e["on_insert"] = array("add_client", null, false);
$e["on_delete"] = array("del_client", null, false);
function add_client($data)
{
phpgrid_error("This is test function for insert");

}

function on_delete($data)
{
phpgrid_error("This is test function for delete");

}

ThankS

Abu Ghufran answered 9 years ago

Refer this code: http://phpgrid.org/demo/demos/editing/server-validation.phps

$e["on_insert"] = array("add_client", null, false);

If you pass last argument as true, functions will act as a filter and insert/update in `->table` will be performed by grid after your function. If last argument is set to false, only your function handler will be executed.

Anand answered 5 years ago

Hi Abu,

I tried this manual insert in cakephp 3 when submit record its showing record added message but no record will be inserted. also when submit the record submit not calling the record add function.

 

$g->set_columns($cols);

$e[“on_insert”] = array(“add_record”, null, false);
$e[“on_update”] = array(“update_by”, null, false);

//$e[“on_update”] = array(“update_by”, null, false);
//$e[“on_insert”] = array(“add_record”, null, false);
//phpgrid_error($e[“on_insert”]);
$g->set_events($e);

//phpgrid_error($data);

function add_record($data)
{
//phpgrid_error($data);
global $g;
$created_by = $this->Auth->user(‘id’);
$created_date = “‘”.date(‘Y-m-d H:i:s’).”‘”;

Thanks

Your Answer

3 + 14 =

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?