We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1778
    • 659 Posts
    Hello all
    [EDIT & SOLVED]
    OK I foiund it, I was calling the home.js and the image.js in the same controller, I had to call only home.js in home controller and only images.js in images controller... Hope it will work as expected now
    [END EDIT]
    I have an ExtJS error 'b is null' in a CMP I develop and can't see where is the error... I have a home panel (the landing page for the CMP) with some buttons on it. Each button redirect to another 'action' for my CMP. The redirection is well done and I reach the good page in my cmp, but I have this extJS error... Fresh eyes needed !

    Here extracts from the code
    in core/components/mediabox/controllers
    //  Controller : home.class.php 
    class MediaboxHomeManagerController extends MediaboxManagerController {
        public function process(array $scriptProperties = array()) {
     
        }
        public function getPageTitle() { return $this->modx->lexicon('mediabox'); }
        public function loadCustomCssJs() {
            $this->addJavascript($this->mediabox->config['jsUrl'].'mgr/widgets/home.panel.js');
            $this->addLastJavascript($this->mediabox->config['jsUrl'].'mgr/sections/home.js');
        }
        public function getTemplateFile() { return $this->mediabox->config['templatesPath'].'home.tpl'; }
    }
    
    
    // controller images.class.php
    class MediaboxImagesManagerController extends MediaboxManagerController {
        public function process(array $scriptProperties = array()) {
     
        }
        public function getPageTitle() { return $this->modx->lexicon('mediabox'); }
        public function loadCustomCssJs() {
    
            $this->addJavascript($this->mediabox->config['jsUrl'].'mgr/widgets/images/images.panel.js');
            $this->addLastJavascript($this->mediabox->config['jsUrl'].'mgr/sections/images.js');
            $this->addJavascript($this->mediabox->config['jsUrl'].'mgr/widgets/home.panel.js');
            $this->addLastJavascript($this->mediabox->config['jsUrl'].'mgr/sections/home.js');
    
        }
        public function getTemplateFile() { return $this->mediabox->config['templatesPath'].'images.tpl'; }
    }
    


    in assets/js/mgr/sections
    // home.js
    Ext.onReady(function() {
        MODx.load({ xtype: 'mbox-page-home'});
    });
     
    Mediabox.page.Home = function(config) {
        config = config || {};
        Ext.applyIf(config,{
            components: [{
                xtype: 'mbox-panel-home',
                renderTo: 'mbox-panel-home-div'
            }]
        });
        Mediabox.page.Home.superclass.constructor.call(this,config);
    };
    Ext.extend(Mediabox.page.Home,MODx.Component);
    Ext.reg('mbox-page-home',Mediabox.page.Home);
    
    
    // and images.js
    Ext.onReady(function() {
        MODx.load({ xtype: 'mbox-page-images'});
    });
     
    Mediabox.page.Images = function(config) {
        config = config || {};
        Ext.applyIf(config,{
            components: [{
                xtype: 'mbox-panel-images',
                renderTo: 'mbox-panel-images-div'
            }]
        });
        Mediabox.page.Images.superclass.constructor.call(this,config);
    };
    Ext.extend(Mediabox.page.Images,MODx.Component);
    Ext.reg('mbox-page-images',Mediabox.page.Images);
    
    


    And some basic code for the 2 panels
    // home panel
    Mediabox.panel.Home = function(config){
        config = config || {};
        Ext.apply(config,{
            border: false,
            baseCls: 'modx-formpanel',
            cls: 'container',
            items: [{
                html: '<h2>'+_('mbox')+'</h2><h3>'+_('mbox.desc')+'</h3>',
                border: false,
                cls: 'modx-page-header'
            },{
                xtype: 'button',
                text: 'go',
                handler: function(){
                    location.href='?a='+MODx.request.a+'&action=images'
                }
            }] 
        });
        Mediabox.panel.Home.superclass.constructor.call(this,config);
    };
    Ext.extend(Mediabox.panel.Home,MODx.Panel,{});
    Ext.reg('mbox-panel-home',Mediabox.panel.Home);
    
    // images panel
    Mediabox.panel.Images = function(config){
        config = config || {};
        Ext.apply(config,{
            border: false,
            baseCls: 'modx-formpanel',
            cls: 'container',
            items: [{
                html: '<h2>'+_('mbox')+'</h2><h3>'+_('mbox.images')+'</h3>',
                border: false,
                cls: 'modx-page-header'       
            }]
        });
        Mediabox.panel.Images.superclass.constructor.call(this,config);
    };
    Ext.extend(Mediabox.panel.Images,MODx.Panel);
    Ext.reg('mbox-panel-images',Mediabox.panel.Images);
    
    



    I've done that kind of things multiple times and this time I have this "b is null" error and can't find where is the problem...

    Any clue ?
    Thanks
    Cheers
    [ed. note: anso last edited this post 14 years, 6 months ago.]