卡片布局不与表格一起使用 - Sencha Touch 2

时间:2012-04-02 19:34:35

标签: javascript extjs sencha-touch-2

我想要两种形式,&我想使用卡片布局,这样当用户提交form1时,他将被带到form2。但是,当我尝试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', {});

3 个答案:

答案 0 :(得分:1)

请注意,Sencha Touch 2中的数组项目是从0开始索引的,所以如果你想激活第二个,它应该是这样的:

MyApp.container.setActiveItem(1)

已编辑:我已经明白了。您应该在视图中添加另一个配置:fullscreen:true并且它应该可以正常运行:)

答案 1 :(得分:0)

你的表格xtype是'formsPage'自定义,我似乎无法在doco中找到它?如果不是,那可能会导致问题。

doco还建议您不要直接创建卡片布局,而是使用轮播或标签面板。也许使用旋转木马作为基础组件,然后将每张卡片分开制作?这将使您的意图明确,每张卡片/表格都是独立的。

希望有所帮助

答案 2 :(得分:0)

执行以下操作: 扩展轮播

  1. extend:'Ext.Carousel',
  2. 将配置部分更改为:

    1. config:{     标题:'患者登记',     iconCls:'用户',     cls:'卡'     ----
    2. 猜测应该解决它