How to use on_insert and on_after_insert with dialog layout

QuestionsHow to use on_insert and on_after_insert with dialog layout
C3media asked 6 years ago

Hello,

I’m using dialog layout to separe sections based in differents Tables.

So the main table (user), use on_insert event; then on_after_insert to finish the insert operation for other 4 tables relateds by ID.

How to use it, looking that fields of the other 4 tables are not present in the main table (user)?

Regards

1 Answers
Abu Ghufran Staff answered 6 years ago

Hello,

If you on_insert table is set with 3rd param to false, e.g.

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

Then, you can get inserted ID using:

$insert_id = $grid->execute_query($sql,false,”insert_id”);

and move all code of after_insert in same on_insert callback.

If you are using on_insert with 3rd param to true, then in after_insert you will get the inserted ID in $data param.
With the first column already filled with new id. e.g.

Refer: https://www.phpgrid.org/demo/demos/editing/custom-events.phps Line 140

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

2 + 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?