Kabeer
Kabeer

Reputation: 4236

Loading of custom class not working in Ext Js

I'm trying following code but it doesn't work. I can see in the browser status bar that the right javascript file from the right path is being loaded but the UI doesn't show up. On the contrary, if I have the entire code inline (inside app.js) all works as anticipated. I'm using Ext Js 4.1.1.

app.js

Ext.onReady(function () {
    Ext.Loader.setConfig({
        enabled: true,
        paths: {
            'company': './src/company'
        }
    });
    var largeHomeButton = Ext.create('company.classes.ToolbarLargeButton', {
        iconCls: 'home32'
    });
    var myToolbar = Ext.create('Ext.toolbar.Toolbar', {
        items: [largeHomeButton]
    });
    var master = Ext.create('Ext.panel.Panel', {
        layout: 'absolute',
        x: 0, y: 0,
        height: 100, width: 110,
        border: 5,
        lbar: [myToolbar]
    });
    Ext.create('Ext.Viewport', {
        layout: 'anchor',
        items: [master]
    });
});

src/company/classes/ToolbarLargeButton.js

Ext.define('ToolbarLargeButton', {
    extend: 'Ext.button.Button',
    scale: 'large',
    iconAlign: 'center'
});

Upvotes: 0

Views: 648

Answers (1)

sha
sha

Reputation: 17860

I think you should specify full class name in Ext.define:

Ext.define('company.classes.ToolbarLargeButton', {

Upvotes: 3

Related Questions