how to extend DashletView?

I have extended a RecordView and it works perfectly.

SugarPro/custom/modules/XXX/clients/base/views/record/record.js

({
    extendsFrom: 'RecordView',

    initialize: function (options) {
        this._super('initialize',[options]);
        this.model.on('sync', this.changeField, this);
    },

    changeField: function() {

        var temp_fields = ['active_intergrations_c'];              
        var accountId = this.model.get("client_tech_stack_accountsaccounts_idb");

        $.ajax({
            url: "rest/v10/connectedappsapi/getactiveintegrations",
            data: { "firmId": accountId },
            dataType: "json",
            type: "POST",
            success: _.bind(function (response) {
                if (response && response.status === "success") {
                    if (!_.isEmpty(response.data)) {                        
                        this.model.set('active_intergrations_c', response.data);                       
                    }
                } else {                    
                    app.alert.show('message-id', {
                        level: 'info',
                        messages: 'Unable to get Active Integrations data!.',
                        autoClose: true
                    });
                }
            }, this)
        });
    },   
});


However, when I try to extend the DashletView, I find that the JavaScript is not loading. Any suggestions would be appreciated.
SugarPro/custom/modules/XXX/clients/base/views/recorddashlet/recorddashlet.js

({
    extendsFrom: 'DashletView',

    initialize: function (options) {
        this._super('initialize', [options]);
        this.collection.on('sync', this.render, this);
        console.log('dashlet initialize.');
    },

    render: function () {
        this._super('render');

        debugger;
        // Render the integration data in the dashlet
        var temp_fields = ['active_intergrations_c'];
        var accountId = this.model.get("client_tech_stack_accountsaccounts_idb");
        console.log('dashlet 2');

        $.ajax({
            url: "rest/v10/connectedappsapi/getactiveintegrations",
            data: { "firmId": accountId },
            dataType: "json",
            type: "POST",
            success: _.bind(function (response) {
                if (response && response.status === "success") {
                    if (!_.isEmpty(response.data)) {                       
                        this.model.set('active_intergrations_c', response.data);                       
                    }
                } else {
                    app.alert.show('message-id', {
                        level: 'info',
                        messages: 'Unable to get Active Integrations data!.',
                        autoClose: true
                    });
                }
            }, this)
        });
    },
});


SugarCRM Version 12.0.1 (Build 298 E) (Q2 2022)

Parents
  • more details for the recordview and the dashlet

    for the extension of recordview, it just update the textbox - active_intergrations_c by calling the api

    for the dashlet, it's a Record View Dashlet from above record view.

    I just want to do the same thing as the record view, update the textbox - active_intergrations_c by calling the api when it's load

Reply
  • more details for the recordview and the dashlet

    for the extension of recordview, it just update the textbox - active_intergrations_c by calling the api

    for the dashlet, it's a Record View Dashlet from above record view.

    I just want to do the same thing as the record view, update the textbox - active_intergrations_c by calling the api when it's load

Children
No Data