[CLOSED] Ext.Msg.confirm, making it synchronous

  1. #1

    [CLOSED] Ext.Msg.confirm, making it synchronous

    Is there any way I can make this synchronous?
    Basically, I'm detecting if the grid is dirty before a user can add a row, or re-order rows, or change a a variety of things...
    I'd like to execute diff method based on response...problem is, the method doesn't wait until the response!!!


    isGridDirty: function (c) {
             
                var recs = App.ContentPlaceHolder1_store.getModifiedRecords();
                var dirty=-1
                if (recs.length != 0) {
                    Ext.Msg.alert(CONFIRMS.DIRTYGRID.Title, CONFIRMS.DIRTYGRID.Message.format(c.Message), function (btn) {
                        if (btn == 'yes') {
                            PerformanceMetrics.saveContents(c.CloseWordUI);
                            dirty = false;
                        }
                        else
                            dirty = true;
                    });
                }
              
            },

    And call it like:
    if (!PerformanceMetrics.isGridDirty(DIRTYGRID.ADJUSTMENT)) {
                     
                        App.direct.AddAdjustmentMetric(record.data, {
                            success: function (newRec) {
                                try {
                                    if (newRec.PortfolioPerformanceTitleId != undefined) {
                                        App.ContentPlaceHolder1_grid.getStore().add(newRec);
                                        App.ContentPlaceHolder1_grid.getStore().commitChanges();
                                        App.ContentPlaceHolder1_grid.getView().refresh();
                                        App.ContentPlaceHolder1_grid.doLayout();
                                    }
                                }
                                catch (e) {
                                    alert(e.message);
                                }
                            } 
                        });
                    }
    OR

        if (!PerformanceMetrics.isGridDirty(DIRTYGRID.CURRENCY, newCurr))
                    App.direct.UpdateCurrency(App.ContentPlaceHolder1_cmboQuarters.getValue(), newCurr);
                else
                App.ContentPlaceHolder1_cmboCurrency.setValue(oldCurr);
    Last edited by Daniil; Jan 28, 2014 at 5:24 AM. Reason: [CLOSED]
  2. #2
    Ext.Msg.confirm (and any methods from Ext.Msg) cannot be synchronous, javascript doesn't support such functionality
    Only native alert, confirm methods have such behaviour

Similar Threads

  1. [CLOSED] Ext.Msg.Confirm vs Confirm with DirectEvents
    By csharpdev in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 21, 2013, 10:51 AM
  2. Replies: 2
    Last Post: Jul 10, 2012, 8:09 PM
  3. [CLOSED] Making a TreePanel stateful
    By jwillmott in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 30, 2010, 11:28 AM
  4. Synchronous DirectMethod?
    By glenh in forum 1.x Help
    Replies: 1
    Last Post: Sep 14, 2010, 5:11 AM
  5. Making a callback with coolite from javascript
    By petherson in forum 1.x Help
    Replies: 0
    Last Post: Sep 22, 2008, 10:48 AM

Posting Permissions