Announcement

Collapse
No announcement yet.

Refresh Child Data in UI after server side process

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Refresh Child Data in UI after server side process

    Hi,

    I have a parent child (1 to many) relationship. Both the parent and child data is shown on the UI.
    I have a button on the parent record that calls a postAction that updates data on both the parent and child records.
    After the postAction runs I am able to get the parent data to update to show the new values using this.view.model.fetch(); but the child data does not update.

    This is my action-handler code
    Code:
    $.ajax({
    url: 'ParentRecord/action/calculateTotal',
    type: 'POST',
    data: JSON.stringify(data),
    error: function (xhr, status) {
    var statusReason = xhr.getResponseHeader('X-Status-Reason') || '';
    statusReason = statusReason.replace(/ $/, '');
    statusReason = statusReason.replace(/,$/, '');
    var msg = this.translate('Error') + ' ' + xhr.status;
    if (statusReason) {
    msg += ': ' + statusReason;
    }
    Espo.Ui.error(msg);
    console.error(msg);
    xhr.errorIsHandled = true;
    }.bind(this)
    }).done(function () {
    this.view.model.fetch(); //this updates the parent record data but not the child data
    Espo.Ui.success('Total Calculated');
    }.bind(this));
    Any help on how to refresh the child data in the UI would be appreciated.

  • #2
    Hi Kyle,

    Try:

    Code:
    this.view.model.trigger('update-all');

    Comment


    • #3
      Thanks this works in refreshing all the child records.

      Comment

      Working...
      X