2012-08-15 52 views
0

這是代碼和鏈路上的屏幕截圖分機JS 4佈局

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

當我去掉佈局: '形式' 我有錯誤

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

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

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

但有錯誤,我必須做什麼?

回答

0

layout未在面板的items中定義。它是面板屬性的一部分(請參閱文檔:Form Panel)。把它放在items之前。

作爲一個建議 - 如果您的行具有一致的逗號佈局,將更容易看到它。