Button inside of an input field Sencha Touch 2.0

我是研究僧i 提交于 2019-12-06 04:46:35

问题


What I try to achieve is something alike this:


Only then in a Sencha Touch application. 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? (without using css to float the button above the input.

回答1:


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. Scale your textfield vs button widths with flex config

Hope it helps. :)



来源:https://stackoverflow.com/questions/10119021/button-inside-of-an-input-field-sencha-touch-2-0

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