第二次出现jquery对话框........?

时间:2012-06-29 07:11:52

标签: jquery

我使用简单的模态窗口拨号弹出来显示表格。当我点击这个表的单元格然后另一个jquery对话框弹出来,在这个弹出窗口我显示另一个表(动态内容)。现在的问题是,当我第一次访问它们而不是第二次使用谷歌浏览器(版本19.0.1084.56米)并且在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   

1 个答案:

答案 0 :(得分: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);  

      });
 }

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