ext js 4布局

时间:2012-08-15 08:07:54

标签: layout extjs

这是截图

上的代码和链接
Ext.define('SD.view.SDDetail', {
    extend: 'Ext.window.Window',
    alias: 'widget.sddetail',
    title: "Создание заявки",
    height: 620,
    width: 850,
    layout: 'fit',
    border: false,
    modal: true,
    isDemandReadOnly: false,
    changeStatusOnly: false,

    initComponent: function () {
        var me = this;
        var user = TR.user;

        var f = new Ext.form.FormPanel({
            xtype: 'form',
             labelWidth: 60
            , frame: true
            , items: [{
                    fieldLabel: 'Text'
                    , xtype: 'textfield'
                    , anchor: '-18'
                    }, {
                        layout: 'column'
                    , defaults: {
                        columnWidth: 0.5
                    //, layout: 'form'
                    , border: false
                    , xtype: 'panel'
                    , bodyStyle: 'padding:0 18px 0 0'
                    }
                    , items: [{
                        defaults: { anchor: '100%' }
                    , items: [{
                        xtype: 'combo'
                    , fieldLabel: 'Combo 1'
                    , store: ['Item 1', 'Item 2']
                    }, {
                        xtype: 'datefield'
                    , fieldLabel: 'Date'
                    }]
                    }, {
                        defaults: { anchor: '100%' }
                    , items: [{
                        xtype: 'combo'
                    , fieldLabel: 'Combo 2'
                    , store: ['Item 1', 'Item 2']
                    }, {
                        xtype: 'timefield'
                    , fieldLabel: 'Time'
                    }]
                    }]
                    }, {
                        fieldLabel: 'Text Area'
                    , xtype: 'textarea'
                    , anchor: '-18 -80'
            }]
        });

        this.items = [f];

        this.tbar = {
            xtype: 'toolbar',
            height: 27,
            items: [
                {
                    xtype: "tbspacer"
                }, "-", {
                    xtype: "tbspacer"
                },
                {
                    text: "Прикрепленные файлы",
                    icon: "Content/images/btnAttach.gif",
                    disabled: true,
                    handler: function (btn, e) { ShowAttachments(r.id, true, me.isDemandReadOnly); }
                }, "-", {
                    xtype: "tbspacer"
                }, {
                    text: "История статусов",
                    icon: "Content/images/btnHistory.gif",
                    disabled: true,
                    handler: function (btn, e) { ShowStatusesHistory(r.id, true); }
                }, "-", {
                    xtype: "tbspacer"
                }, {
                    text: "Информация по сопроводительной карточке",
                    icon: "Content/images/btnComplect.gif",
                    disabled: true,
                    handler: function (btn, e) { ShowComponents(r.id, true, me.isDemandReadOnly); }
                }, "-", {
                    icon: "Content/images/btnPrint.gif",
                    text: "Сопроводительная карточка изделия",
                    disabled: true,
                    handler: function (btn, e) { DemandCardForm(r.id); }
                }

        ]
        };

        this.buttons = [
            {
                text: "Сохранить",
                action: 'save'
                , disabled: me.isDemandReadOnly || user.SdUserViewOnly
            }, {
                xtype: "button",
                text: "Отмена",
                handler: function (btn, e) {
                    me.close();
                }
            }
        ];

        //        me.on('show', function () {
        //            me.down('kontragentcombo').focus(false, 250);
        //        });

        me.callParent(arguments);
    }

http://s002.radikal.ru/i198/1208/e2/7a153ca9b116.jpg

当我取消注释布局时:'form'我有错误

命名空间未定义 [Прерыватьнаэтойошибке]

if(namespace === from || namespace.substring(0,from.length)=== from){

我想知道http://i032.radikal.ru/1208/51/e9b8ba1c1f30.jpg

但有错误,我必须做什么?

1 个答案:

答案 0 :(得分:0)

layout未在面板的items中定义。它是面板属性的一部分(请参阅文档:Form Panel)。把它放在items

之前

作为建议 - 如果您的行具有一致的逗号布局,则会更容易看到它。