What is the best way to display text just after a TextField?

≯℡__Kan透↙ 提交于 2019-12-01 08:37:28

If you need it for one field only, a CompositeField is fine. However, do you really need a whole new Panel for the text - wouldn't a regular Label suffice?

If you need a more reusable solution, have a look at the fieldTpl config option of FormLayout. You could modify the template and add a special section after the field, in which to display the additional information.

I'm not aware of a property that'll do what you want with a panel on the right. If it's something you're doing more than once, though, consider making your own type for it:

Ext.ns('Ext.ux.form');

Ext.ux.form.DurationField = Ext.extend(Ext.form.CompositeField, {
  constructor: function(cfg) {
    cfg = Ext.applyIf(cfg || {}, {
      items: [ /** blah blah */ ]
    });
    Ext.ux.form.DurationField.superclass.constructor.call(this, cfg);
  }
});

Ext.reg('durationfield', Ext.ux.form.DurationField);

That will let you use durationfield as though it were a first class citizen.

You could also use a Ext.form.DisplayField (xtype displayfield) inside your composite field to display some static text.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!