2009-07-21 57 views
5

我有一個相當複雜的設置,我已經歸結爲下面的代碼。我有一個外部FormPanel,其中我試圖包括一個子類FormPanel的組件。在FF中,它導致「this.body is null」錯誤。FormPanel中的ExtJS FormPanel失敗,並顯示「this.body is null」

這是否發生在其他人身上?有沒有可能讓這個工作?如果我不需要,我非常不想去觸及這個子類。

var test = new Ext.Window({ 
    title: 'test', 
    items: [{ 
    xtype: 'form', 
    items: [{ 
     // this is where the subclass of FormPanel goes 
     xtype: 'form', 
     items: [{ 
     xtype: 'textfield', 
     fieldLabel: 'Testing' 
     }] 
    }] 
    }] 
}); 
test.show(); 

回答

15

我不確定這是不是你確切的問題,但我知道你永遠不應該將xtype:'form'嵌入到xtype:'form'中。如果你需要它的佈局功能,那麼不要使用xtype:'form',而應該使用layout:'form'的xtype:'panel'。

+1

問題的一個問題,但爲什麼你不應該在xtype:'form'中使用xtype:'form'?我知道它在HTML方面沒有多大意義,但就javascript而言,它們只是對象。 – 2009-07-23 03:25:27

0

你基本上試圖在另一個FormPanel中嵌入一個FormPanel。這不起作用。我想你想要的是這樣的:

var test = new Ext.Window({ 
    title: 'test', 
    items: [{ 
    xtype: 'form', 
    items: [{ 
     xtype: 'textfield', 
     fieldLabel: 'Testing' 
    }] 
    }] 
}); 
test.show(); 
0

我認爲,如果你補上一指標(如隱藏文本框)爲第一「形式」這是可行的。

0

Extjs不會阻止你理解HTML。你不能嵌套窗體。