Sencha Architect - 使用表单创建屏幕

时间:2012-07-12 04:49:01

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

刚开始看看sencha touch

任何人都可以解释一下你将使用的地方" FieldSet,FormPanel和容器"

例如:带有标题,文本字段和提交按钮的表单?

登录屏幕......

Title: Login
TextField: username
PasswordField: password
Button: submit  

1)此登录屏幕是否在容器,字段集和/或formpanel中?

2)没有标题的表格怎么样?只是文本字段,按钮,或只是一个标题,数据列表的屏幕?

1 个答案:

答案 0 :(得分:0)

我认为示例代码对您有所帮助:

Ext.define('MyApp.view.LoginSiteContainer', {
extend: 'Ext.form.Panel',
alias: 'widget.loginsitecontainer',

config: {
    id: 'loginform',
    url: 'som_url',
    items: [            
        {
            xtype: 'container',
            layout: {
                type: 'vbox'
            },
            items: [
                {
                    xtype: 'fieldset',
                    instructions: 'Login using existing account. Password is case sensitive.',
                    title: 'Login details',
                    items: [
                        {
                            xtype: 'textfield',
                            id: 'login',
                            itemId: 'login',
                            label: 'Login'
                        },
                        {
                            xtype: 'passwordfield',
                            id: 'password',
                            itemId: 'password',
                            label: 'Password'
                        }
                    ]
                },
                {
                    xtype: 'panel',
                    layout: {
                        type: 'hbox'
                    },
                    items: [
                        {
                            xtype: 'button',
                            id: 'Login',
                            itemId: 'Login',
                            margin: '0.1em',
                            ui: 'confirm',
                            text: 'Login',
                            flex: 1
                        }
                    ]
                }
            ]
        }
    ],
    listeners: [            
        {
            fn: 'onLoginTap',
            event: 'tap',
            delegate: '#Login'
        }
    ]
},


onLoginTap: function(button, e, options) {
// login function here
}

});

相关问题