最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - ExtJS FormPanel in a FormPanel fails with "this.body is null" - Stack Overflow

programmeradmin1浏览0评论

I have a rather complicated setup which I have boiled down to the code below. I have an outer FormPanel, where I am trying to include a component that is a sub-class FormPanel. In FF it is causing a "this.body is null" error.

Is this happening to anyone else? Is it possible to get this to work? I very much do not want to have to touch the subclass if I don't have to.

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();

I have a rather complicated setup which I have boiled down to the code below. I have an outer FormPanel, where I am trying to include a component that is a sub-class FormPanel. In FF it is causing a "this.body is null" error.

Is this happening to anyone else? Is it possible to get this to work? I very much do not want to have to touch the subclass if I don't have to.

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();
Share Improve this question asked Jul 21, 2009 at 17:12 John KJohn K 3851 gold badge2 silver badges11 bronze badges
Add a comment  | 

4 Answers 4

Reset to default 15

I'm not sure if this is your exact issue, but I do know you are never supposed to embed an xtype: 'form' into an xtype: 'form'. If you need its layout functionality then instead of xtype: 'form', use xtype: 'panel' with layout: 'form'.

I think it would work if you added something (f.e. hidden textfield) into first 'form'.

Extjs doesn't stop you from needing to understand HTML. You can't have nested forms.

You are essentially trying to embed a FormPanel inside another FormPanel. This will not work. I think what you want is this:

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

评论列表(0)

  1. 暂无评论