sencha touch 2.0 : How to split a form across tab

2019-06-11 00:02发布

问题:

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

回答1:

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 ;)



回答2:

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'
            }]
        }
    ]
});