简体   繁体   English

卡布局不适用于表格-Sencha Touch 2

[英]Card layout not working with forms - Sencha Touch 2

I want to 2 forms, & I want to use card layout, so that when the user submits form1, he is taken to form2. 我想要2个表单,并且我想使用卡片布局,以便当用户提交form1时,他被带到form2。 But, when I try to MyApp.container.setActiveItem(2) (using console), it does not move to form2(card2). 但是,当我尝试使用控制台通过MyApp.container.setActiveItem(2) )时,它不会移动到form2(card2)。

    Ext.define('MyApp.view.Forms', {
    extend: 'Ext.Container',
    xtype: 'formsPage',
    id: 'formsForm',

    config: {
        title: 'Patient Registration',
        iconCls: 'user',
        layout:{
            type: 'card'
        },

        items: [
        {
            xtype: 'fieldset',
            title: 'Patient Registration1',
            items: [
                {
                    xtype: 'textfield',
                    label: 'Names',
                    name: 'name'
                },
                {
                    xtype: 'textfield',
                    label: 'City',
                    name: 'city'
                }
            ]
        },
        {
            xtype: 'fieldset',
            title: 'Patient Registration1',
            items: [
                {
                    xtype: 'textfield',
                    label: 'Phone',
                    name: 'phone'
                },
                {
                    xtype: 'textfield',
                    label: 'Country',
                    name: 'conutry'
                }
            ]
        }
    ],  
    constructor:function(config) {
            this.initConfig(config);
            return this;
        }

    }

});

MyApp.container = Ext.create('MyApp.view.Forms', {});

Please note that array items in Sencha Touch 2 are indexed from 0, so if you want to activate second one, it should be something like this: 请注意,Sencha Touch 2中的数组项是从0开始索引的,因此,如果要激活第二个数组项,它应该是这样的:

MyApp.container.setActiveItem(1)

Edited: I've figured it out. 编辑:我已经弄清楚了。 You should add another config to your view: fullscreen:true and it should work well :) 您应该在视图中添加另一个配置: fullscreen:true ,它应该可以很好地工作:)

Is your form xtype of 'formsPage' custom, I can't seem to find it in the doco? 您的“ formsPage”表单xtype是否自定义,我似乎无法在doco中找到它? If it's not, that might be contributing to the issue. 如果不是,那可能是导致问题的原因。

The doco also suggests that you don't create the card layout directly, but instead use carousel or tab panel. Doco还建议您不要直接创建卡片布局,而应使用轮播或标签面板。 Maybe use a carousel as your base component, then make each card a separate form? 也许将轮播用作您的基本组件,然后将每张卡制作成单独的表格? This would make your intentions clear that each card/form is to be independent. 这可以使您清楚地表明每张卡/表格都是独立的。

Hope that helps 希望能有所帮助

do the following: extend the carousel 请执行以下操作:扩展轮播

  1. extend: 'Ext.Carousel', 延伸:“ Ext.Carousel”,

change the config section to: 将配置部分更改为:

  1. config: { title: 'Patient Registration', iconCls: 'user', cls: 'card' ---- config:{title:'患者注册',iconCls:'user',cls:'card'----

guess that should fix it 猜猜应该解决它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM