[英]Button inside of an input field Sencha Touch 2.0
What I try to achieve is something alike this: 我试图实现的是类似的东西:
Only then in a Sencha Touch application. 只有在Sencha Touch应用程序中才有。 I have achieved an input field with a button next to it but not a button inside of a input field. 我已经实现了一个输入字段,旁边有一个按钮,但没有输入字段内的按钮。
Is there a way to get this functionality in Sencha Touch 2? 有没有办法在Sencha Touch 2中获得此功能? (without using css to float the button above the input. (不使用css浮动输入上方的按钮。
you can achieve this, let's try: 你可以实现这一点,让我们试试:
{
xtype: 'textfield',
component: {
xtype: 'container',
layout: 'hbox',
items: [
{
xtype: 'textfield',
flex: 3,
},
{
xtype: 'button',
flex: 1,
text: 'test'
}
]},
},
Explanation : component
is a special config for input fields and by default, it's set to {xtype: "input", type: "text"}
, that's the key of this work-around. 说明 : component
是输入字段的特殊配置,默认情况下,它设置为{xtype: "input", type: "text"}
,这是此解决方法的关键。 Scale your textfield
vs button
widths with flex
config 使用flex
配置缩放textfield
与button
宽度
Hope it helps. 希望能帮助到你。 :) :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.