문제

im trying to put a form inside a window, im working on the example of the web desktop,i add a new entry on the start menu an that entry it is supposed to call a window and inside that window there must be a form, but it seems to be unable to display the form inside the window. Im pastying the code of the form and the module that creates the window.

Now the issue its solved so im going to put the solution right here inside the code.

Code for the panel

Ext.define('MyDesktop.HelloWorldWindow',{
    extend:'Ext.form.Panel',
    bodyPadding: 10,
    defaultType: 'textfield',
    items: [
        {
            fieldLabel: 'First Name',
            name: 'firstName',
            anchor:'100%'
        },
        {
            fieldLabel: 'Last Name',
            name: 'lastName',
            anchor:'100%'
        },
        {
            xtype: 'datefield',
            fieldLabel: 'Date of Birth',
            name: 'birthDate',
            anchor:'100%'
        }
    ]
});

Code for the module that creates the window.

Ext.define('MyDesktop.HelloWorldWindowModule', {
    extend: 'Ext.ux.desktop.Module',

    init : function(){
        this.launcher = {
            text: 'Hello World',
            iconCls:'bogus',
            handler : this.createWindow,
            scope: this,
            id:'hello-world'
        }
    },

    createWindow : function(src){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('hello-world');
        var hello = new MyDesktop.HelloWorldWindow();
        if(!win){

            win = desktop.createWindow({
                id: 'helloWorld',
                title:src.text,
                width:640,
                height:480,
                iconCls: 'bogus',
                animCollapse:false,
                constrainHeader:true,
                items: [hello]
            });
        }
        win.show();
        return win;
    }
});

And just displays this when i click the "Hello World" option in the menu. Web Desktop

And now the magick works ;) It works!

도움이 되었습니까?

해결책

In createWindow add layout:'fit' and change item to items:[hello]

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top