javascript - 扩展 : Redirecting to other page

标签 javascript extjs extjs4

这是我的代码:

Ext.onReady(function() {
    Ext.create('Ext.panel.Panel', {
        title: 'Results',
        width: 600,
        height: 400,
        renderTo: Ext.getBody(),
        items: [{
                xtype: 'container',
                layout: 'form',
                style: 'width : 200px;margin-top: 10px ',
                items: [{
                    xtype: 'textfield',
                    fieldLabel: 'Name',
                    id: 'name',
                    style: 'width : 100px;'
                }]
            }, {
                xtype: 'container',
                layout: 'form',
                style: 'width : 200px;margin-top: 10px ',
                items: [{
                    xtype: 'datefield',
                    fieldLabel: 'Date',
                    id: 'date'

                }]
            }, {
                xtype: 'container',
                layout: 'form',
                style: 'width : 200px;margin-top: 10px ',
                items: [{
                    xtype: 'textfield',
                    vtype: 'email',
                    fieldLabel: 'EmailId',
                    id: 'email'

                }]
            }, {
                xtype: 'container',
                layout: 'form',
                style: 'margin-top: 10px ',
                items: [{
                    xtype: 'button',
                    text: 'signup',
                    float: 'right',
                    handler: function() {

                        Ext.Ajax.request({
                            method: 'GET',
                            url: 'rest/helloworld/',
                            disableCaching: false,
                            success: function() {
                                Ext.Msg.alert('', 'success');
                                Window.Location.assign('abc.js');

                            },
                            failure: function() {
                                Ext.Msg.alert('', 'failed');

                            },
                            params: {
                                name: Ext.getCmp('name').getValue(),
                                email: Ext.getCmp('email').getValue(),
                                date: Ext.getCmp('date').getValue()

                            }
                        });
                    }
                }]
            }

        ]

    });
});

一切都很顺利:

我真正需要的是在成功警报后加载另一个 ExtJS 页面。

我尝试了 Window.Location.assign('abc.js') 但它不起作用。

Extjs 新手。

请帮忙

最佳答案

问题 1(与 Ext-JS 无关):不是 Window.Location ,而是 window.location

问题2(Ext-JS问题):Ext.Msg.alert对话框是异步的。 location.assign('www.google.com') 行将在对话框显示后立即运行,而不是在关闭后运行

要等到按钮按下后,您必须向其传递一个回调。

 Ext.Msg.alert('','success', function() {
     // Note that window is not necessary here, just location.assign will do
     window.location.assign('abc.js');
 });

关于javascript - 扩展 : Redirecting to other page,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29522623/

相关文章:

javascript - 如何将正则表达式序数转换为 <上标 [JavaScript]?

php - 通过 <img> 或 <a> 标签加载可执行代码?

javascript - Ajax 测试(wordpress)

javascript - 在列上分组时动态隐藏 ExtJS 4 网格列

coldfusion - 如何在 ColdFusion 9 EXTJS 网格列上设置 typeAhead=true?

javascript - 选择 htmleditor 字段文本并将其复制到剪贴板

javascript - 如何渲染一个tabpanel下的所有组件?

javascript - JS代码在手机上不起作用

extjs - 未捕获的 Ext.AbstractManager.register() : Registering duplicate id

javascript - 如何在 Javascript 中同时验证多封电子邮件?