2012-06-29 40 views
0

我正在使用简单的模态窗口弹出来显示一个表格。当我点击这个表格的单元格时,另一个jquery对话框弹出窗口会出现在这个弹出窗口中,我显示了另一个表格(动态内容)。现在的问题是这两个dilaog拿出罚款,当我访问他们第一次,但在谷歌浏览器不能正常工作第二次(版本19.0.1084.56米),并在Mozilla工作正常(13.0.1)jquery对话框没有出现第二次........?

I am giving some code snippet if there is something wrong plz help me.... 
//my first function which creates simple modal dialog on which i am writing content of another page dash.jsp (creating table) 
     // Maptrans.jsp page 
     function clicker1(){ 
          alert("modal1"); 
        var divString="<table>"+ 
       "<tr>"+ 
           "<td> 
            <table> 
             <div id='dash'></div> 
            </table> 
          </td>"+ 
         "</tr> 
       </table>"; 
         alert("modal2"); 
         $("#basic-modal-content").html(divString); 
         $("#basic-modal-content").modal(); 
         alert("modal3"); 


    //Getting data of dash.jsp and write on dash div 
       $.post("dash.jsp",function(data){ 
         $("#dash").html(data); 
       }); 

// dash.jsp function called when i will click on cell of first table 
    function access(test1,facilityName,status){ 
     alert("dialog1"); 
var divString="<table>"+ 
         "<tr>"+ 
          "<td > 
           <div id='rfidMove'><img src='img/basic/loader0.gi/></div> 
         </td>"+ 
     "</tr> 
       </table>"; 

      alert("dialog2"); 

$("#rfi").html(divString); 

$("#rfi").dialog({ 
      width: '650', 
      height: '500', 
      zIndex : '3000', 
      modal:true, 
      title: "RFID INVENTORY DETAIL", 
      overlay: { opacity: 0.1, background: 'black'}, 
      open: function(event, ui) { 
       $("#rfidMove").css("display", ""); 
      }, 
      close: function(event, ui){ 

      $("#rfi").dialog('destroy'); 

      } 
    }); 

    alert("dialog3"); 


    $.post("RfidInventory.jsp?","container="+test1+"&facilityName="+facilityName+"&status="+status, function(data){ 

     alert("dialog4"); 

     $("rfidMove").css("display","none"); 
     $("#rfi").html(data); 

     }); 
} 


// In both function i am getting alert before creation of dialog but after dialog creation code not.... 
I have spent alot of time to figure it out but unable to found any solution plz help ... Thanks 

回答

0

是它每次关闭对话框时都需要$("#rfi").dialog('destroy');
我认为,最好在其他地方创建对话框,例如在jquery.ready().open()它点击您的表格单元格。

编辑:
也许,你需要的是这样的:

$(function(){ 
    //construct dialog once in jquery.ready() 
    $("#rfi").dialog({ 
      width: 650, 
      height: 500, 
      zIndex : 3000, 
      modal:true, 
      title: "RFID INVENTORY DETAIL", 
      overlay: { opacity: 0.1, background: 'black'}, 
      open: function(event, ui) { 
       $("#rfidMove").css("display", ""); 
      } 
    }); 
}) 

...

function access(test1,facilityName,status){ 
     alert("dialog1"); 
     var divString="<table>"+ 
         "<tr>"+ 
          "<td > 
           <div id='rfidMove'><img src='img/basic/loader0.gi/></div> 
         </td>"+ 
     "</tr> 
       </table>"; 

      alert("dialog2"); 

$("#rfi").html(divString); 

    //reuse already created dialog 
    $("#rfi").dialog('open'); 

    alert("dialog3"); 


    $.post("RfidInventory.jsp?","container="+test1+"&facilityName="+facilityName+"&status="+status, function(data){ 

     alert("dialog4"); 

     $("rfidMove").css("display","none"); 
     $("#rfi").html(data); 

     }); 
} 

和修复你缩进请。这是痛苦的看看代码:)

+0

你可以PLZ传播更多的光在这个..... – vips

+0

@vips,我已经编辑了我的答案。一探究竟。 – Niemand

相关问题