extjs ajax 同步 及 confirm 确认提示框问题

 1 //上传文件
 2     uploadModel: function() {
 3         
 4         if(Ext.getCmp('exup').getForm().isValid()) {
 5             
 6             var ssn = this.upPanel.getCmpByName('ssn').getValue();
 7             var ssy = this.upPanel.getCmpByName('ssy').getValue();
 8             var pzid = this.upPanel.getCmpByName('pzid').getValue();
 9             
10             //判断导入数据是否重复
11             Ext.Ajax.request({
12 
13                 url : __ctxPath + '/gzt/sameDataGztDrLog.do',
14                 params : {
15                     ssn : ssn,
16                     ssy : ssy,
17                     pzid : pzid
18                 },
19                 async:false,
20                 method : 'POST',
21                 scope:this,
22                 success : function(response, options) {
23                     var json = Ext.util.JSON.decode(response.responseText);
24 //                    alert(response.responseText);
25                     if(json.success){
26                         var msg = json.message;
27                         if(msg == 'same'){
28                             Ext.Msg.confirm('提示', '发现重复记录,继续导入将覆盖旧数据,确认继续导入吗?', function(btn) {
29                                 if (btn == 'yes') {
30                                     this.zxdr1();
31                                 }
32                             },this);
33                         }else{
34                             this.zxdr1();
35                             
36                         }
37                     }else{
38                         Ext.ux.Toast.msg('操作信息', json.message);
39                     }
40                 },
41                 failure : function(response, options) {
42                     Ext.ux.Toast.msg('操作信息', '操作出错,请联系管理员!');
43                 }
44                 
45                 
46             });
47             
48             
49             }
50         
51         
52     }

extjs3 ajax 本身没有同步方法,需要引入ext-basex.js

confirm( String title, String msg, Function fn, Object scope ) : Ext.MessageBox提示框,与alert不同,为异步方法,要点确认按钮后才执行的方法需要写在其回调函数中,
如果要调用其他方法,注意作用域参数 scope 的使用,是confirm的参数,而不是回调函数的
原文地址:https://www.cnblogs.com/dirgo/p/10715752.html