This topic is locked

How To Use Aftersave Javascript Event?

6/12/2013 2:24:45 PM
PHPRunner General questions
P
pccmarkets author

We have PHPRunner Enterprise 6.2. When editing a detail record in inline edit mode within a list view, we'd like to reload the page after an inline save so the master record details displayed on the page gets updated. I've seen a number of references to "afterSave" in these forums (like here) and can even find this in PHPRunner's JavaScript file, but is seems missing from the official documentation (though there is some info on beforeSave). Nor can we get it to work.
Is this still supported in 6.2? If so, can someone please provide instructions on how to use?
Thanks in advance.

C
cgphp 6/14/2013

Provide an example of what you don't see updated in the master record when you edit a detail record.

P
pccmarkets author 6/14/2013



Provide an example of what you don't see updated in the master record when you edit a detail record.


Just be be clear, the master record does get updated in the database. The problem is when in list view for the master database table, inline edits performed to detail records via AJAX don't update the master record HTML table row. Once you refresh the page, the master record displays the correct information. Our users need immediate feedback without the need to manually refresh when doing an inline edit in this scenario. Perhaps there is another way?
We're building a cooking class registration system. A registration is comprised of one or more seats for a class. So Registration is the master and Seat is a detail. Class fees are set in the seat records. A registration is also comprised of one or more payments. Making Payment another detail of Registration. Via triggers, we update a registration record with the total amount owed (fees) and the total amount paid (payments). We then also display at the registration level the balance.
When you add a seat (and thus fees) or a payment via an inline edit, AJAX is only updating the HTML table row of the detail record. So while the total fees, amount paid and balance are being updated in the database, the master registration HTML table row has NOT been updated to reflect these changes. Our goal is simply to refresh the page after a successful inline edit save, but we can't figure out a reliable way to do this. I was hoping we could somehow use the afterSave event, but that doesn't seem to be working or I'm unclear on how to properly implement it.
Thanks for reviewing!

Admin 6/14/2013

Check live demo of Invoice template: http://xlinesoft.com/invoice
You can see invoice total changing as soon as quantity or price changes. You can achieve this implementing onchange event of child table fields. More info:

http://xlinesoft.com/phprunner/docs/show_dropdown_list_of_us_states.htm

P
pccmarkets author 6/14/2013



Check live demo of Invoice template: http://xlinesoft.com/invoice
You can see invoice total changing as soon as quantity or price changes. You can achieve this implementing onchange event of child table fields. More info:

http://xlinesoft.com/phprunner/docs/show_dropdown_list_of_us_states.htm


Thanks. I had considered updating the master dynamically using JavaScript, but I wanted to avoid duplicating business logic both client side and server side. Also, we would only want to trigger based on a successful save, not a field change. Are the only available events listed here available?
One idea that I had was to trigger based on the transition from the green check mark back to the inline edit icon? Do you think that is a feasible approach?