简体   繁体   English

ExtJS复合字段不在FF中显示

[英]ExtJS composite field does not display in FF

I created a fieldset that is part of the form and have just display porpuse: 我创建了一个字段集,该字段集是表单的一部分,并且只显示了porpuse:

H_Info = Ext.extend ( Ext.form.FieldSet, {
  title:         'Origination Info',
  labelWidth:    1,

  initComponent : function ( ) {
    this.items = [ {
      xtype:       'displayfield',
      name:        'Name'
    }, {
      xtype:       'displayfield',
      name:        'Address'      
    }, {
      xtype:       'compositefield',            
      items:       [ {
        xtype:        'displayfield',
        name:         'OrgDate',
        width:        100       
      }, {
        xtype:        'displayfield',
        name:         'OrgValue',
        width:        120,
        flex:         1      
      } ]
    }, {
       xtype:    'displayfield',
       name:     'CurrentValue'      
    } ];

    H_Info.superclass.initComponent.call ( this );  

  } // initComponent 

} );

It works as predicted in IE 6.0 fields are displayed in expected places, however when I try it in FF 2 fields (OrgDate, and OrgValue) grouped in compositefield are not displayed. 它按预期工作在IE 6.0字段中,并显示在预期的位置,但是,当我尝试在FF 2字段(OrgDate和OrgValue)中尝试时,则不会显示在Compositefield中分组的字段。

Any idea what I am missing ? 知道我缺少什么吗?

I think this has to with the fact that on render ExtJS does not see any fixed height content in the fields (input fields) because you are not using labels (which have a height based on the font size when there is actually something in there) and only using displayFields, which are just empty text elements (the form is rendered empty first, I think you are loading it after that from a store or something). 我认为这与以下事实有关:渲染ExtJS在字段(输入字段)中看不到任何固定高度的内容,因为您没有使用标签(当标签中实际有东西时,标签的高度取决于字体大小)并且仅使用displayFields,它们只是空的文本元素(表单首先呈现为空,我认为您是在之后从商店或其他地方加载它的)。

From your code I reckon that you don't want to show labels (labelwidth 1), but you can still use the labels to trick the renderer to think there is text in there (non braking space), thereby setting the height of the surrounding component to match that (Check the two defaults items added to the main component and the composite field: 从您的代码中,我认为您不想显示标签(labelwidth 1),但是您仍然可以使用标签来欺骗渲染器以使其中存在文本(非制动空间),从而设置周围的高度组件以使其匹配(检查添加到主组件和组合字段中的两个默认项:

H_Info = Ext.extend ( Ext.form.FieldSet, {
  title:         'Origination Info',
  labelWidth:    1,
  defaults: {
      fieldLabel: ' ',
      labelSeparator: ' '
  },

  initComponent : function ( ) {
    this.items = [ {
      xtype:       'displayfield',
      name:        'Name'
    }, {
      xtype:       'displayfield',
      name:        'Address'      
    }, {
      xtype:       'compositefield',
      defaults: {
          fieldLabel: ' ',
          labelSeparator: ' '
      },            
      items:       [ {
        xtype:        'displayfield',
        name:         'OrgDate',
        width:        100       
      }, {
        xtype:        'displayfield',
        name:         'OrgValue',
        width:        120,
        flex:         1      
      } ]
    }, {
       xtype:    'displayfield',
       name:     'CurrentValue'      
    } ];

    H_Info.superclass.initComponent.call ( this );  

  } // initComponent 

} );

Hope this solves your problem, Cheers, 希望这能解决您的问题,干杯,

Rob

Rob suggest to add defaults in compositefield like this: Rob建议像这样在Compositefield中添加默认值:

....
      xtype:       'compositefield',
      defaults: {
          fieldLabel: ' ',
          labelSeparator: ' ',
          height: 12
      }, 
      ....

add height to it, it not perfect solution, however it will overwrite height and force compositefield to display (show up) 向其添加高度,这不是完美的解决方案,但是它将覆盖高度并迫使CompositeField显示(显示)

What version of ext are you using? 您正在使用哪个版本的ext? I tried your code in the latest version, 3.3.1 and it seems to be working fine in FF3.6, IE8, and Chrome7. 我在最新版本3.3.1中尝试了您的代码,它在FF3.6,IE8和Chrome7中似乎运行良好。 Here is a Screenshot: 这是屏幕截图: SS

OrgValue is not expanding via flex because you also have a size defined. OrgValue不会通过flex进行扩展,因为您还定义了大小。 If you remove the "width:120: from OrgValue then it expands to the full width. 如果您从OrgValue中删除了“ width:120:”,则它将扩展为完整宽度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM