【问题标题】:Sencha touch form panel is not showingSencha 触控面板未显示
【发布时间】:2012-11-23 22:22:42
【问题描述】:

由于某种原因,我的表单面板没有显示。任何人都可以帮忙吗?我是新手,如果这很明显,我很抱歉!它是用 Sencha Architect 构建的,但我不明白为什么表单中没有显示任何字段?...

Ext.define('MyApp.view.Login', {
    extend: 'Ext.Container',

    config: {
        layout: {
            type: 'vbox'
        },
        items: [
            {
                xtype: 'titlebar',
                docked: 'top',
                title: 'My Title'
            },
            {
                xtype: 'toolbar',
                docked: 'top',
                items: [

                    {
                        xtype: 'button',
                        text: 'Call'
                    },
                    {
                        xtype: 'button',
                        text: 'Email'
                    }                       
                ]
            },
            {
                xtype: 'container',
                flex: 1,
                border: 2,
                items: [
                    {
                        xtype: 'formpanel',
                        styleHtmlContent: true,
                        items: [
                            {
                                xtype: 'fieldset',
                                title: 'MyFieldSet',
                                items: [
                                    {
                                        xtype: 'textfield',
                                        label: 'Field'
                                    },
                                    {
                                        xtype: 'textfield',
                                        label: 'Field'
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }

});

【问题讨论】:

    标签: sencha-touch sencha-touch-2 sencha-architect


    【解决方案1】:

    要在其他容器中使用 Sencha Touch 2.3+ 正确显示表单面板(Ext.form.Panel),您需要添加 scrollable: null 属性

    {
        xtype: 'formpanel',
        scrollable: null,         
        items: [
            ...
        ]
    }
    

    见讨论here

    【讨论】:

      【解决方案2】:

      将登录视图的layoutvbox 更改为fit。然后将包含您的表单面板的容器的layout 也设置为fit

      查看this link 了解有关 Sencha Touch 布局的更多信息。

      【讨论】:

      • '容器'是哪几个?
      • 两个容器;)为了更清楚,我编辑了答案。谢谢。
      • 它实际上只需要一个 layout: 'fit' 在包含表单面板的容器上
      • 是的,你是对的。我自己在 Architect 中检查它,但当登录视图具有 vbox 布局时,我忘记在包含表单面板的容器上设置 flex 属性。如果未设置flex 属性,则两个容器都应具有layout: 'fit'
      • 其实,既然我把这个标记为正确,为什么如果容器内没有其他东西,flex: 1 与 fit 的效果不一样?
      猜你喜欢
      • 1970-01-01
      • 2012-01-15
      • 1970-01-01
      • 1970-01-01
      • 2018-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多