Обновить сетку после отправки формы / загрузки файла Excel? - PullRequest
0 голосов
/ 06 сентября 2018

После загрузки файла Excel во всплывающем окне сетка должна автоматически заполняться без нажатия какой-либо другой кнопки. Но это не работает. Если кто-то может помочь в этом. Я использую функцию Обновить в своем коде ниже, чтобы загрузить новые записи в сетке:

Ext.define('App.controller.Component.Buttons.Import', {
extend: 'Ext.app.Controller',
refs: [
    { ref: 'Current', selector: 'App-View-TabPanel' }
],
init: function () {
    var me = this;
    me.control({           
        '[xtype="App-View-Import-FileUpload"] #ImportButton': {
            click: this.FileUpload
        }
    });

},
Import: function (button) {   
        var win = Ext.create({
            xtype: 'App-View-Import-FileUpload',
            param: {},
            autoScroll: true,
            width: 550,
            height: 200,
            modal: true,
            closable: true
        });

        win.show();
},
FileUpload: function FileUpload(me) {
        me.up('window').hide();
        form.submit({
            url: 'api/Import/FileUpload',
            waitMsg: 'Uploading your file...',
            scope: this,
            success: function (fp, o) {  
                this.Refresh();
                me.up('window').close();
                Ext.Msg.alert('Import Excel', 'File uploaded successfully. <br>Prior to saving, please confirm no errors exist.');  
            },
            failure: function (fp, o) {
                me.up('window').close();
                    if (o.result.errors) {
                    Ext.Msg.alert('Import Excel', 'Failed to upload the file.');
                }
                else {
                    Ext.Msg.alert('Import Excel', 'File uploaded successfully.');
                }

            }
        });
},

Refresh: function (me) {
    var tabPanel = me.getCurrent(),
        currentTab = tabPanel.getActiveTab();
    if (currentTab.title != 'Import') {
        tabPanel.setActiveTab(tabPanel.down('#Import'));
    } else {
        var grid = me.getCurrent().getActiveTab();
        store.load();
    }
}});
...