How to re-render the "record view" of a quote after a background processing triggered by a button ?

Hi,

I am facing a problem that is maybe easy for some of you

  • on the quote module, I created a custom button
  • when triggered, a custom API is called
  • a part of this API process is to reorganize the Quote Line Items

My problem is the following : how to force the re-render of the quote record view (quote record and also the QLI section) after my API call is successful ?

Best regards,

Fred

Parents
  • You basically want to refresh the related QLIs

    I am not sure if Quotes is different but I have a custom module and when something changes in one subpanel I want to refresh the collection in another subpanel.

    To do this I use the controller and trigger a refresh when needed (there is a process not seen here that deletes some Product Detail records when the Product is deleted).

    The refresh function looks like this:


      refreshDetails: function() {
        //refreshes ProductDetails subpanel after an item is deleted from the Products Subpanel.
        var parentContract = this.context.parent.get('model'),
            detailsLink='wcont_wolframcontractpdetails_wcont_wolframcontracts',
            contractDetailsCollection = parentContract.getRelatedCollection(detailsLink);
        contractDetailsCollection.fetch({relate:true});
      },

    In short: I get the parent, get the related collection I want to refresh and trigger another fetch on that collection. The system takes care of the re-render when the fetch is triggered.

    Hope this works for your scenario.

    FrancescaS

  • Hi,

    thanks this might work for other modules. But initialy we asked this question to find a workaround with the bug of the "extra-info" layout in Quotes (where bundles and products are showed) when fetching the collection it does not "refresh" the view but only add again the bundles resulting on having multiple duplicates displayed.

    we succeeded to get around by disposing the bundles components before sugar displays the new ones. The trigger in our context is when we change a specific field that is only changed just before save. At this point we do this :

    this.layout.getComponent('extra-info').getComponent('quote-data-list-groups').groupIds.forEach(
    function(grpId,index){
        var grp = this.layout.getComponent('extra-info').getComponent('quote-data-list-groups')._getComponentByGroupId(grpId);
        if(grp !== undefined) {
            grp.dispose();
        }
    }
    ,this);

    you may want to adapt/optimize if this operation is to be done many times before changing view because I noticed the disposed components are still referenced in the layout, making it a possible memory leak issue.

Reply
  • Hi,

    thanks this might work for other modules. But initialy we asked this question to find a workaround with the bug of the "extra-info" layout in Quotes (where bundles and products are showed) when fetching the collection it does not "refresh" the view but only add again the bundles resulting on having multiple duplicates displayed.

    we succeeded to get around by disposing the bundles components before sugar displays the new ones. The trigger in our context is when we change a specific field that is only changed just before save. At this point we do this :

    this.layout.getComponent('extra-info').getComponent('quote-data-list-groups').groupIds.forEach(
    function(grpId,index){
        var grp = this.layout.getComponent('extra-info').getComponent('quote-data-list-groups')._getComponentByGroupId(grpId);
        if(grp !== undefined) {
            grp.dispose();
        }
    }
    ,this);

    you may want to adapt/optimize if this operation is to be done many times before changing view because I noticed the disposed components are still referenced in the layout, making it a possible memory leak issue.

Children
No Data