首页 新闻 会员 周边

Javascript/Jquery 同步弹窗---急

0
悬赏园豆:80 [待解决问题]

遇到一个问题,循环插入一组数据,每条数据插入前都需要给用户提示确认,因此需要用window.confirm 方法给用户提示。但是现在享有jquery ui 替换该提示窗口,由于jquery ui是异步的因此不能阻止代码中断,请大神赐教!!!请看下面伪代码!!!

$.each(nodes,function(node,index){
 if (!window.confirm("确定插入" + node.Id + "吗?"))
   return;
setCursor(node);

// 处理其他逻辑

}

问题补充:

没人啊

greg_echo的主页 greg_echo | 初学一级 | 园豆:127
提问于:2015-04-03 10:50
< >
分享
所有回答(3)
0
function alertSync(nodes, i){
  jqueryui.confirm('确定插入'' + nodes[i].Id + '吗?', function(){
    //干正事
    setCursor(node[i]);
    //下一轮
    setTimeout(function(){
      alertSync(nodes, i + 1);
    }, 0);
  });
}

大概这种思路去完成。
幻天芒 | 园豆:37175 (高人七级) | 2015-04-03 10:59
0

这要是插入很多条数据,够用户忙的了

Mr.靠谱 | 园豆:208 (菜鸟二级) | 2015-04-09 10:44
0

用 jquery ui dialog, set modal to true

$( "#dialog-confirm" ).dialog({
        resizable: false,
        height:140,
        modal: true,
        buttons: [{
            text: "OK",
            click : function() {    
                $( this ).dialog( "close" );
                // do your stuff 
                }
            }, {
            text: "Cancel",
            click: function() {
                $( this ).dialog( "close" );                
            }}]
    });
gunsmoke | 园豆:3592 (老鸟四级) | 2015-04-10 12:35
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册