Events: on_insert, on_update, on_delete

QuestionsEvents: on_insert, on_update, on_delete
Sebastián Esteller asked 10 years ago

Hello friends,
We have a problem with insertion, update or delete data from grid when use events.
For example when use on_update event in grid, this event works correcty but not update record in grid.

The same problem with other operations.

You can see code in this url >> http://chiringuitoweb.com/zonaprivadatdg/socis_table.txt

Can you help me please?
Thank you very much. Sebastian.

4 Answers
Sebastián Esteller answered 10 years ago

Sorry i'm not used pastebin, i don't see the instructions! Attach in this post url of the same code in pastin:

File: http://pastebin.com/mhDDWAw3

thanks!Sebastián.

Abu Ghufran answered 10 years ago

Hi,

The current code:

$e["on_insert"] = array("insert_soci", null, false);
$e["on_update"] = array("update_soci", null, false);
$e["on_delete"] = array("delete_soci", null, false);

Will only execute the code inside function and skip the default grid update/insert routine because the 3rd argument if set to false.

If you want to update with normal grid operation, you need to set 3rd argument to true.

Docs:

If you pass last argument as true, functions will act as a data filter and insert/update in `->table` will be performed by grid after your function.

Sebastián Esteller answered 10 years ago

Thanks for support!
Other question. Can you see the array $data in funcition on event.

For example

function update_soci($data){
print_r($data);
}

I don't see any echo, print_r, not works!! I need activate debug or other feature! Thanks!

Abu Ghufran answered 10 years ago

try this:

function update_soci($data){
ob_start();
print_r($data);
$str = ob_get_clean();
phpgrid_error($str);
}

Your Answer

12 + 11 =

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?