Row id after insert

Hello,
the id of a new row after insert is the grid’s id if I do not refresh the page, if I do, I get the correct one (the one I have in my db). Is there a way for me to get the correct one without refreshing the page (or the grid)?
I saw a function in the connector $action->get_new_id() which I can use in afterProccessing, is this something like mysql_insert_id() in php? and how do I get the connector to put it as gridRow id?
Thank you in advance,
Andreas.

Normally after inserting new row, client side code changes id to the value which was set by database ( works only for insert, will not work for update )

So if you are using default connector saving functionality, new id value will be automatically sent to client side and updated in grid ( assuming that you have auto-increment id column )

If you are using custom saving logic, you can use onAfterInsert event and from it call $action->set_new_id($value);