0

I am using simple modal window to show dynamic content(table) on modal window popup. The close event is working fine when I am simply showing data in modal window.

But if I am showing another jquery dialog popup on simple modal window after closing jquery popup dialog, My simple modal window popup onClose event is not working.

   // Base Modal popup
   $('#simple').modal({
       onShow: function() { 
           alert("activated"); 
       },
       onClose: function() {
           alert("deactivated");
           $.modal.close(); 
       }
   });

   // Jquery popup
   $('#kick').dialog({
       //ajax calls to show data  
   });

close event is not working second time even when I am using $.modal.close(); Please... please help me... I had already spent one day in this...

franzlorenzon
  • 5,845
  • 6
  • 36
  • 58
vips
  • 183
  • 1
  • 5
  • 16

3 Answers3

0

Just some ideas since I dont' have VS2010 on this computer and can't confirm the actual syntax :(

$('#simple').close();
$(this).modal.close();
this.close();

though, this is how we close a dialogue box:

$(this).dialog("close"); 

so maybe this will work?

$(this).modal("close"); 
Losbear
  • 3,255
  • 1
  • 32
  • 28
  • $("#basic-modal-content").modal( { onShow : function() { alert("before show"); }, onClose : function() { alert("before closing"); var a = this; a.close(); } }); – vips Aug 28 '12 at 06:40
0
     // I get rid of this

            $("#basic-modal-content").modal( {
    onShow : function() {
          // anything you want to do before 
               },
    onClose : function() {
        // when closing popup anything you wanna do 
        var a = this;
        a.close();
    }

    });
vips
  • 183
  • 1
  • 5
  • 16
0

For this you have to open the second popup after closing the first one which takes around 2 sec. So, if you use settimeout() function and call the second pop by providing 2sec delay or greater than this. It will work. Since, this is not a proper way to do so. But it actually works for me.

I am using Simple modal jquery plugin: Here is the code:

$('#forgot_password_modal').click(function (e) {
$.modal.close(); // this is written to close all the popups.
setTimeout(function(){
    $('#forgot_password_form').modal({   //to open a second popup
        minHeight:570,
        minWidth:600,
        maxWidth:671,
        opacity: 90,
    onOpen: function(dialog) {
            dialog.overlay.fadeIn('slow', function() {
                dialog.data.hide();
                dialog.container.fadeIn('slow', function() {
                    dialog.data.slideDown('slow');

                });
            });
        },
        onClose: function(dialog) {
            dialog.data.fadeOut('slow', function() {
                dialog.container.slideUp('slow', function() {
                    dialog.overlay.fadeOut('slow', function() {
                        $.modal.close(); // must call this!
                    });
                });
            });
        }});
}, 2000);    
    return false;
});
Shantanu Nirale
  • 105
  • 1
  • 10