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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Alan Lord (News)
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

_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vt7: can I listen for postAjaxSaveEvent in Detail.js? [Resolved]

Alan Lord (News)
Just to help anyone else, you can trap this event:

My custom event:
> registerSvcPostAjaxSaveEvent: function () {
> app.event.on(Vtiger_Detail_Js.PostAjaxSaveEvent, function (e, fieldBasicData, postSaveRecordDetails,contentHolder) {...

the var "postSaveRecordDetails" contains all the record's field values;
not just the one that was edited and saved.

HTH

Al

On 26/01/17 15:07, Alan Lord wrote:

> 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);


_______________________________________________
http://www.vtiger.com/
Loading...