How Hide SubPanel custom Module on Demand ?

How is the process to remove a subpanel ?

Parents
  • Hi, Rodrigo.

    You can try this one to include in custom js file:

    (function appFunc(app) {
        app.events.on("app:start", function appStartFunc() {
            if (!app.view.layouts.BaseSubpanelsLayout && !app.view.layouts.BaseCustomSubpanelsLayout) {
                app.view.declareComponent("layout", "subpanels", undefined, undefined, false, "base");
            }

            var subpanelsLayout = "BaseSubpanelsLayout";

            if (app.view.layouts.BaseCustomSubpanelsLayout) {
                subpanelsLayout = "BaseCustomSubpanelsLayout";
            }

            if (App.view.layouts[subpanelsLayout].hideIMSubpanel === true) {
                return;
            }

            App.view.layouts[subpanelsLayout] = App.view.layouts[subpanelsLayout].extend({
                hideIMSubpanel:   true,
                _hiddenSubpanels: [],
                
                initialize: function () {
                    var result = this._super("initialize", arguments);

                    if (this.model.module === "ModuleNAmeisHere") {
                        app.api.call("read", "rest/v10/ModuleNAmeisHere/" + this.model.id + "?fields=name", null, {
                            success: function apiCallSuccess(model) {
                              this._hideUnnecessarySubpanel("subpanelrelationship Link or table");
                           
                            }.bind(this)
                        });
                    }

                    return result;
                },

                /**
                 * Add to the _hiddenSubpanels array, and hide the subpanel
                 */
                _hideUnnecessarySubpanel: function (link) {
                    this._hiddenSubpanels.push(link);
                    var component = this._getSubpanelByLink(link);

                    if (!_.isUndefined(component)) {
                        component.hide();
                    }
                    this._hiddenSubpanels = _.unique(this._hiddenSubpanels);
                },

                /**
                 * Helper for getting the Subpanel View for a specific link
                 */
                _getSubpanelByLink: function (link) {
                    return this._components.find(function findComponent(component) {
                        return component.context.get("link") === link;
                    });
                },

            });
        });
    })(SUGAR.App);

    laxmichand

Reply
  • Hi, Rodrigo.

    You can try this one to include in custom js file:

    (function appFunc(app) {
        app.events.on("app:start", function appStartFunc() {
            if (!app.view.layouts.BaseSubpanelsLayout && !app.view.layouts.BaseCustomSubpanelsLayout) {
                app.view.declareComponent("layout", "subpanels", undefined, undefined, false, "base");
            }

            var subpanelsLayout = "BaseSubpanelsLayout";

            if (app.view.layouts.BaseCustomSubpanelsLayout) {
                subpanelsLayout = "BaseCustomSubpanelsLayout";
            }

            if (App.view.layouts[subpanelsLayout].hideIMSubpanel === true) {
                return;
            }

            App.view.layouts[subpanelsLayout] = App.view.layouts[subpanelsLayout].extend({
                hideIMSubpanel:   true,
                _hiddenSubpanels: [],
                
                initialize: function () {
                    var result = this._super("initialize", arguments);

                    if (this.model.module === "ModuleNAmeisHere") {
                        app.api.call("read", "rest/v10/ModuleNAmeisHere/" + this.model.id + "?fields=name", null, {
                            success: function apiCallSuccess(model) {
                              this._hideUnnecessarySubpanel("subpanelrelationship Link or table");
                           
                            }.bind(this)
                        });
                    }

                    return result;
                },

                /**
                 * Add to the _hiddenSubpanels array, and hide the subpanel
                 */
                _hideUnnecessarySubpanel: function (link) {
                    this._hiddenSubpanels.push(link);
                    var component = this._getSubpanelByLink(link);

                    if (!_.isUndefined(component)) {
                        component.hide();
                    }
                    this._hiddenSubpanels = _.unique(this._hiddenSubpanels);
                },

                /**
                 * Helper for getting the Subpanel View for a specific link
                 */
                _getSubpanelByLink: function (link) {
                    return this._components.find(function findComponent(component) {
                        return component.context.get("link") === link;
                    });
                },

            });
        });
    })(SUGAR.App);

    laxmichand

Children