0

我正在使用简单的模态窗口对话框弹出来显示一个表格。当我单击此表的单元格时,将出现另一个 jquery 对话框弹出,在此弹出窗口中我显示另一个表(动态内容)。现在的问题是,当我第一次访问它们但第二次在谷歌浏览器(版本 19.0.1084.56 m)中无法正常工作并且在 mozilla(13.0.1)中正常工作时,这两个 dilaog 都可以正常工作

  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   
4

1 回答 1

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);  

      });
 }

请修正你的缩进。看代码很痛苦:)

于 2012-06-29T07:42:29.750 回答