0

ボタンがあり、ユーザーがボタンをクリックするたびに、別のビュー/ページを表示する必要があります(別のビューに移動します)。

たとえば、画面Aにはボタンがあり、そのボタンをクリックすると、画面Bに移動する必要があります。

私のコードは次のとおりです。

onLoginSuccess : function(){
Ext.create('Ext.container.Viewport', {

                    items: [
                    {
                        xtype: 'screenb'
                    }
                    ]
                });
}

しかし、どういうわけか、画面Aのボタンをクリックすると、画面Bに移動し、画面Aも画面Bに表示されます。画面Aを削除する必要があります(ユーザーがボタンをクリックして画面のみを表示した後) B)

=====================アップデート2 =========================== ============

Ext.define('Proj.view.loca.Person' ,{
    extend: 'Ext.form.Panel', 
    alias : 'widget.person',

    items: [

            {
        xtype: 'textfield',
        fieldLabel: 'Name',
        name: 'name'
    }, {
        xtype: 'textfield',
        fieldLabel: 'School',
        name: 'school'
      }],
    buttons: [{
        text: 'Submit',
        handler: function() {
            var form = this.up('form').getForm();
            if (form.isValid()) {
                form.submit({
                    success: function(form, action) {
                    Ext.create('Ext.container.Viewport', {

                    items: [
                    {
                        xtype: 'screenb'
                    }
                    ]
                });

                    },
                    failure: function(form, action) {
                    // Navigate to some other view
                    }
                });
            }
        }
    }]
});
4

1 に答える 1

2

これを実現する最善の方法は、カード レイアウトを使用することだと思います。

おおよその方法は次のとおりです。

Ext.application({
    name: 'BS',

    appFolder: 'app',

    refs:
    [{
        ref: 'viewport',
        selector: 'viewport'
    }],

    launch: function() {

        Ext.create('Ext.container.Viewport', {
            layout: 'card',
            items: [{
                xtype: 'panel',
                id: 'panel1',
            },{
                xtype: 'panel',
                id: 'panel2',        
            }]
        });
    },


    onLoginSuccess : function() {
        this.getViewport().getLayout().setActiveItem(1);        
    }

});
于 2012-07-04T12:38:20.080 に答える