2
votes

Can't find out why its isn't working.. I'm trying create a custom panel for multiple uses. Is it the way? Or am i totally wrong.

I'm a beginner in ExtJS, so i'll be happy to a little explain.. thanks (i'm trying to run this code on the fiddle to see the immediate result - )

Ext.application({

    name: 'Fiddle',

    launch: function () {
        var custom = Ext.define('Ext.BET', {
            renderTo: Ext.getBody()
        });

    }
});

Ext.define('Ext.BET', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.bet',
    constructor: function (cnfg) {
        this.callParent(arguments);
        this.initConfig(cnfg);
    },
    config: {
        collapsible: true,
        frame: true,
        bodyStyle: 'background-color: #FFFFFF',
        layout: {
            type: 'hbox'
        },
        items: [{
            xtype: 'textfield',
            textarea: focus,
            id: 'tbx'
        }, {
            xtype: 'button',
            id: 'btn'
        }, {
            xtype: 'button',
            id: 'search'
        }]

    },
    afterRender: function () {
        var btn = Ext.getCmp('btn');
        var tbx = Ext.getCmp('tbx');
        var btn2 = Ext.getCmp('search');
        var totalWidth = btn2.getWidth() + btn.getWidth() + tbx.getWidth();
        this.setWidth(totalWidth);
    },
    onRender: function() {
        this.callParent(arguments);
    }
});
1
You want to run this on fiddle ? Means should we correct this code or what you want ? - Tejas
i'm running this code on: fiddle.sencha.com/#view/editor just to see if its work. but i gonna use it elsewhere just to explain the : "name: 'Fiddle'," - mendy
You should not use ext.define instead use ext.create.But then its breaking in afterrender event ..checking this thing , will update fiddle once it fix it. - Tejas
thank you very much! i was stuck on this a lot.. - mendy
i cant upvote your answer because i am a new user... - mendy

1 Answers

2
votes

You should use Ext.create instead of Ext.define.Refer this fiddle.