0

私の問題は、コントロールイベントをクリックしてフォームパネルを表示する別のビューを持っていることです。表示する空白の画面..何をしているのかわかりません。フォーム パネルは、sencha フォーム パネル チュートリアルから取られています。

以下は私のフォームパネルビューです

Ext.define('WinReo.view.AddContact', {
    extend: 'Ext.Container',
    xtype: 'addcontact',
    requires: [
        'Ext.TitleBar'
        //'Ext.Video'
    ],
    config: {
        layout:'fit'

    },
    initialize:function(){
        console.log('inside initialize');
        var formPanel = Ext.create('Ext.form.Panel', {
            //xytpe:'formpanel',
            fullscreen: true,
            layout:'fit',

            items: [{
                xtype: 'fieldset',
                items: [
                    {
                        xtype: 'textfield',
                        name : 'name',
                        label: 'Name'

                    },
                    {
                        xtype: 'emailfield',
                        name : 'email',
                        label: 'Email'
                    },
                    {
                        xtype: 'passwordfield',
                        name : 'password',
                        label: 'Password'
                    }
                ]
            }]
        });

        formPanel.add({
            xtype: 'toolbar',
            docked: 'bottom',
            layout: { pack: 'center' },
            items: [
                {
                    xtype: 'button',
                    text: 'Set Data',
                    handler: function() {
                        formPanel.setValues({
                            name: 'Ed',
                            email: 'ed@sencha.com',
                            password: 'secret'
                        })
                    }
                },
                {
                    xtype: 'button',
                    text: 'Get Data',
                    handler: function() {
                        Ext.Msg.alert('Form Values', JSON.stringify(formPanel.getValues(), null, 2));
                    }
                },
                {
                    xtype: 'button',
                    text: 'Clear Data',
                    handler: function() {
                        formPanel.reset();
                    }
                }
            ]
        });

    }
});

これは、フォーム パネル ビューを表示するためのコントローラー イベントです。

    onItemSwiped: function(list,index,target,record,e)
        {
var addcontact= Ext.create('WinReo.view.AddContact');
            Ext.Viewport.add(addcontact);
            Ext.Viewport.setActiveItem(addcontact);
        },

単純な作業ですが、これを修正するのに時間がかかりすぎています..この問題を解決するのを手伝ってください. 前もって感謝します..

4

1 に答える 1

0

setActiveItem に関するあなたの権利と、それを使用する必要があります。Ext.Viewport.add() は viewPort にのみ追加するため、ビューは表示されません。

したがって、コードの唯一の問題は、formPanel を作成したが、AddContact ビューに追加していないことです。

    ........... 
    // same code
                {
                    xtype: 'button',
                    text: 'Get Data',
                    handler: function() {
                        Ext.Msg.alert('Form Values', JSON.stringify(formPanel.getValues(), null, 2));
                    }
                },
                {
                    xtype: 'button',
                    text: 'Clear Data',
                    handler: function() {
                        formPanel.reset();
                    }
                }
            ]
        });
        this.add(formPanel); // add this line
    }
});

このフィドルを参照してください

于 2013-06-10T05:06:24.540 に答える