Custom subpanel row action

Hi . All

i want to custom sugarcrm 7.9 subpanel action row add link for generate or download subpanel to PDF format.

This is the screen looks like.

i want custom add the link download PDF in the action row edit and unlink, and when user click data in subpanel can download as PDF format . Actually i am just try to add action button top-panel following this link SugarCRM7 HOW TO:  Manipulate Subpanel Top Buttons (Actions)  but when i am override the subpanel top-panel is gone. 

any solution for my issue 

1. add subpanel row action for download PDF 

2. generate subpanel module data to PDF format 

thanks

regards Eka Indra

Francesca Shiekh Alex Nassi Madalina Papacica

rowaction sugar 7.9.0

Parents Reply Children
  • Hello Eka Indra

    I had a similar task ( print a PDF template from a custom button), I found the function that makes the magic for the record view.

    The field 'pdfaction' has the solution ( clients/base/fields/pdfaction/pdfaction.js)

    On your controller do the following...

    1.- Add a listener to custom button event:

    events: {
            'click [data-action=download]': 'downloadClicked',
        },

    2.- Create the functions to handle the event:

    /**
         * Handles download pdf link.
         *
         * Authenticate in bwc mode before triggering the download.
         *
         * @param {Event} evt The `click` event.
         */
        downloadClicked: function(evt) {
            var templateId = this.$(evt.currentTarget).data('id');

            app.bwc.login(null, _.bind(function() {
                this._triggerDownload(this._buildDownloadLink(templateId));
            }, this));
        },

    /**
         * Download the file once authenticated in bwc mode.
         *
         * @param {String} url The file download url.
         * @protected
         */
        _triggerDownload: function(url) {
            app.api.fileDownload(url, {
                error: function(data) {
                    // refresh token if it has expired
                    app.error.handleHttpError(data, {});
                }
            }, {iframe: this.$el});
        },

    3.- Quick repair and rebuild.

    I hope this help you. Regards