sencha touch 2.0 : How to split a form across tab

2019-06-10 23:41发布

I would like to split a form across several tab panels to avoid a (very) long form (forcing the user to scroll quite a lot to fill every field).

For the moment, I use fieldsets to group fields, but I would like to put the respective fields in separate tabs.

Is there a way to do that ?

Thanks

2条回答
孤傲高冷的网名
2楼-- · 2019-06-11 00:10

Yes, Create a tab panel and put each respective field(s) in its own tab

Ext.create('Ext.TabPanel', {
    fullscreen: true,
    tabBarPosition: 'bottom',

    defaults: {
        styleHtmlContent: true
    },

    items: [
        {
            title: 'Tab1',
           html: 'Tab 1',
            items:[{
                xtype:'textfield',
                fieldLabel:'Name'
            }]
        },
        {
            title: 'Tab2',
            html: 'Tab 2',

            items:[{
                xtype:'textfield',
                fieldLabel:'Date'
            }]
        }
    ]
});
查看更多
再贱就再见
3楼-- · 2019-06-11 00:26

Actually, it is simply possible to add a 'tabpanel' inside the 'formpanel', and the fields values will still be accessible (when using getValues() or submit())...

Simple enough ;)

查看更多
登录 后发表回答