在TextField之后显示文本的最佳方法是什么? [英] What is the best way to display text just after a TextField?

查看:87
本文介绍了在TextField之后显示文本的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个通过xtype创建的表单(不为每个项目调用新的)。
我想在TextField右边添加一个精度。



我设法通过设置一个包含TextField +标准面板的CompositeField但是有没有更好的方法,像TextField中的财产我会错过或更好的选择?



感谢您的帮助! :)

  new Ext.form.FormPanel({
'id':'create-form',
'header':true,
'headerAsText':true,
'hideCollapseTool':true,
'title':'New Component',
'width':550 ,
'style':'margin:100px auto',
'labelWidth':200,
'items':[
{
'items':[
{
'xtype':'textfield',
'fieldLabel':'持续时间(小时)',
'name':'name'
}
]
}
]
});


解决方案

如果您只需要一个字段, code> CompositeField 没问题。但是,您是否真的需要一个全新的面板的文本 - 常规的标签足够吗? p>

如果您需要更多可重用的解决方案,请查看FormLayout 。您可以修改模板,并在字段后添加一个特殊部分,以显示其他信息。


I'm creating a formpanel with items created via xtype (not calling new for each items). I'd like to add a precision at the right of the TextField.

I managed to do it by setting a CompositeField containing the TextField + a standard Panel, but is there a better way, like a property in the TextField I would have missed or a better alternative ?

Thanks for your help ! :)

new Ext.form.FormPanel ({
    'id':                   'create-form',
    'header':               true,
    'headerAsText':         true,
    'hideCollapseTool':     true,
    'title':                'New Component',
    'width':                550,
    'style':                'margin: 100px auto',
    'labelWidth':           200,
    'items': [
        {
            'items': [
                {
                    'xtype':            'textfield',
                    'fieldLabel':       'Duration (in hours)',
                    'name':             'name'
                }
            ]
        }
    ]
});

解决方案

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.

这篇关于在TextField之后显示文本的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆