[Vtigercrm-developers] vt7: can I listen for postAjaxSaveEvent in Detail.js?

Alan Lord alanslists at gmail.com
Thu Jan 26 15:07:19 GMT 2017


I'm very close to sorting out the issues with picklists and fields 
etc... I've moved all the calculations I wanted to perform into the 
Record Model and simply overidden the Save method to perform my 
calculations _before_ saving the record model.

This SaveAjax call returns "all field values" back to Detail_Js as json 
in the var postSaveRecordDetails in the function 
registerAjaxEditSaveEvent().

What I would really like to do is to listen for the event that occurs 
around line 1369:

> var postAjaxSaveEvent = jQuery.Event(Vtiger_Detail_Js.PostAjaxSaveEvent);
> app.event.trigger(postAjaxSaveEvent, fieldBasicData, postSaveRecordDetails, contentHolder);

Basically, what is happening when I change a value of _any_ field in 
Detail View is the SaveAjax Action is called, and on return there's a 
block of json with _all_ the field values. But the function above only 
updates the field which was edited with the new value. What I want to do 
is to update another field - the new value is in the json payload, and 
has been saved to the database, but as it is not the same field as the 
one that triggered the SaveAjax call it isn't getting updated.

I recall in version 6 using something like a postAjaxEvent notifier 
thing but I can't really work out if I can do what I want or not.

If not I will probably just copy the whole registerAjaxEditSaveEvent() 
into a custom Detail class and handle it locally but it would be nice if 
I could simply listen for this and do it myself rather than having to 
hack an already quite large and complex function.


Al



More information about the vtigercrm-developers mailing list