AnsweredAssumed Answered

How to redirect default custom module view to another layout?

Question asked by Chad Hutchins on May 26, 2016
Latest reply on May 27, 2016 by Chad Hutchins

Hi everyone, I have a custom module and I'm trying to redirect it's default module view (the one that would show a list view) when you click on the module name from the main module menu at the top of the page. The best I can come up with is this:


Add the code below to this file: modules/MyCustomModule/clients/base/layouts/default/default.js


  extendsFrom: 'DefaultLayout',
    initialize: function(options) {
        this._super('initialize', [options]);
        window.SUGAR.App.router.navigate('#MyCustomModule/layout/setup', {trigger:true});


This works. It will redirect to the layout specified on line 5, however it throws a "Uncaught TypeError: Cannot read property 'append' of null" in sidecar. No matter what I put for line #5 (console.log, alert, another function, etc.) it doesn't matter, it will throw the "Uncaught TypeError". If I remove line #5 there is no error at all.


Is there a way to do this without the javascript error? Is there a better way to redirect from the default module page?