Results 1 to 7 of 7

Thread: After closing window reload store

  1. #1
    Ext JS Premium Member
    Join Date
    Aug 2011
    Location
    Sweden
    Posts
    31
    Answers
    2

    Default Answered: After closing window reload store

    After I've closed a dialog I want to reload my grid.

    Grid:
    Code:
        loadGridData: function(companyNo) {
            //cache param for future reloads
            this.companyNo = companyNo;
            var selectedDate = this.getSelectedDate();
            var dateFrom = Ext.Date.getFirstDateOfMonth(selectedDate);
            // var dateTo = Ext.Date.getLastDateOfMonth(selectedDate);
    
            this.loadStore(companyNo, dateFrom);
            // this.loadStore(companyNo, dateFrom, dateTo);
    
    
        },
        
    
    
        
        showConfirmationDialog: function(empNo) {
            var dialog = Ext.create('Intelliplan.Modules.Staffing.BookEmployee.Consultant.Shift.BookingConfirmationDialog',
                {
                    consultantEmpNo: empNo
                }
            );
           // dialog.add();
            dialog.show();
           
        },
    dialog:
    Code:
    Ext.define('Intelliplan.Modules.Staffing.BookEmployee.Consultant.Shift.BookingConfirmationDialog', {
        extend: 'Intelliplan.Modules.Staffing.BookEmployee.Consultant.Shift.BookingConfirmationDialogUi',
        consultantEmpNo: undefined,
        initComponent: function () {
    
            this.callParent(arguments);
            this.defineReferences();
    
            //handlers
            this.sendMailDialogButton.on('click', this.onSendMailDialogButtonClick, this);
            this.sendSmsDialogButton.on('click', this.onSendSmsDialogButtonClick, this);
            this.clearConfirmationNeedButton.on('click', this.onClearConfirmationNeedButtonClick, this);
            this.emailConfirmation.on('emailConfirmationSent', this.onEmailConfirmationSent, this);
            this.smsConfirmation.on('smsConfirmationSent', this.onSmsConfirmationSent, this);
            this.bookShiftGrid.on('selectedRestransKeysChanged', this.onSelectedRestransKeysChanged, this, {buffer: 2000});
    
        },
        defineReferences: function() {
            this.emailConfirmation = this.down('#emailConfirmation');
            this.sendMailDialogButton = this.down('#sendMailDialogButton');
            this.bookShiftGrid = this.down('#bookShiftGrid');
            this.smsConfirmation = this.down('#smsConfirmation');
            this.sendSmsDialogButton = this.down('#sendSmsDialogButton');
            this.clearConfirmationNeedButton = this.down('#clearConfirmationNeedButton');
            this.getBottomToolbar().cancelButton = this.getBottomToolbar().down('#cancelButton');
    
        },
    
        onCancelButtonClick: function() {
            this.close();
    
        },
    
        onSendMailDialogButtonClick: function () {
            if (!this.bookShiftGrid.checkRowIsSelected())
                return;
    //        var data = {
    //            empNo: this.consultantEmpNo,
    //            resTransKeys: this.bookShiftGrid.selectedResTransKeys
    //        };
            this.emailConfirmation.sendEmailConfirmation(this.bookShiftGrid.selectedResTransKeys);
        },
        onSendSmsDialogButtonClick: function () {
            
            if (!this.bookShiftGrid.checkRowIsSelected())
                return;
    //        var data = {
    //            empNo: this.consultantEmpNo,
    //            resTransKeys: this.bookShiftGrid.selectedResTransKeys
    //        };
    
            this.smsConfirmation.sendSmsConfirmation(this.bookShiftGrid.selectedResTransKeys);
        },
    
    
        onEmailConfirmationSent: function() {
            this.refreshBookShiftGrid();
        },
        onSmsConfirmationSent: function() {
            this.refreshBookShiftGrid();
        },
        onClearConfirmationNeedButtonClick: function() {
            if (!this.bookShiftGrid.checkRowIsSelected())
                return;
    
            var url = Intelliplan.Api.BaseUrl + '/Staffing/ConsultantConfirmation/DeleteConfirmationNeed'
    
            var data = {
                empNo: this.consultantEmpNo,
                resTransKeys: this.bookShiftGrid.selectedResTransKeys
            };
    
            var errorMessage = IPtranslate('Intelliplan.Common.Messaging.Mail.Standard.TemplateGenerationErrorMessage');
            Intelliplan.Util.Ajax.post(url, data, true, function() {
                this.refreshBookShiftGrid();
            }, errorMessage, this);
        },
        refreshBookShiftGrid: function() {
            this.bookShiftGrid.loadStore();
            this.bookShiftGrid.view.refresh();
        },
        onSelectedRestransKeysChanged: function() {
    //        var data = {
    //            empNo: this.consultantEmpNo,
    //            resTransKeys: this.bookShiftGrid.selectedResTransKeys
    //        };
    
            this.smsConfirmation.generateReportChange(this.bookShiftGrid.selectedResTransKeys);
            this.emailConfirmation.generateReportChange(this.bookShiftGrid.selectedResTransKeys);
        }
    });
    any Ideas?

  2. Yes, if you are in the onCancelButtonClick you can reference and load youre store like this

    Code:
    var store = Ext.data.StoreManager.lookup('myStore');
    store.load({
        params: yourparams,
        scope   : this,
        callback: function(records, operation, success) {
            //the operation object contains all of the details of the load operation
            console.log(records);
        }
    });
    But you must put a storeId on your store, else storeManager can not find it.

    Code:
    Ext.create('Ext.data.Store', {
        model: 'SomeModel',
        storeId: 'myStore'
    });

  3. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,199
    Answers
    87

    Default

    I dont know what your dialog is extending, but if it is a window, try this.

    Code:
    closeAction: 'hide'
    on your dialog.

  4. #3
    Ext JS Premium Member
    Join Date
    Aug 2011
    Location
    Sweden
    Posts
    31
    Answers
    2

    Default

    No it didn't work :/

  5. #4
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,199
    Answers
    87

    Default

    Sorry didn't read your question well, I thought you got a problem while reloading it but youre not in that stage yet.

    I think on the close event of your dialog, get your store and call its function store.load();

    so what is your question or problem? What doesn't work?

  6. #5
    Ext JS Premium Member
    Join Date
    Aug 2011
    Location
    Sweden
    Posts
    31
    Answers
    2

    Default

    In my dialog I got a cancel button, when I press it the dialog close:
    Code:
     onCancelButtonClick: function() {
            this.close();
    
        },
    And when it close I wanted to reload the grid store.

    Maby something you said: "get your store and call its function store.load(); "

  7. #6
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,199
    Answers
    87

    Default

    Yes, if you are in the onCancelButtonClick you can reference and load youre store like this

    Code:
    var store = Ext.data.StoreManager.lookup('myStore');
    store.load({
        params: yourparams,
        scope   : this,
        callback: function(records, operation, success) {
            //the operation object contains all of the details of the load operation
            console.log(records);
        }
    });
    But you must put a storeId on your store, else storeManager can not find it.

    Code:
    Ext.create('Ext.data.Store', {
        model: 'SomeModel',
        storeId: 'myStore'
    });

  8. #7
    Ext JS Premium Member
    Join Date
    Aug 2011
    Location
    Sweden
    Posts
    31
    Answers
    2

    Default

    Thank you! It works excellent!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •