2014-04-01 3 views
1

여러 개의 대화 상자를 차례로 열려고합니다 (첫 번째 대화 상자가 열리고 Ajax 요청이 성공한 경우 두 번째 대화 상자가 표시됩니다). 첫 번째 대화 상자가 올바르게 열립니다. 화면의 중앙에 있지만 닫을 때 두 번째 대화 상자가 중앙의 페이지 상단에 열리지 않습니다.jquery 대화 상자 체인하기 : 두 번째 대화 상자가 중앙에 없음

빌드 페이지를 사용하고 모든 것을 선택했기 때문에 모든 jquery UI 종속성을 사용할 수 있습니다.

나는 모두 시도했다 : 123 성공하지 못함.

프로젝트가 크고, 내가 사용하고있는 코드에 가까운 메이크업 코드를 만들고 있습니다.

첫째, 나 자신을 해결까지 종료 대화

$(".btblock").click(function (event) { 

    event.preventDefault(); 

    var btn = $(this); 

    var id= btn.attr('id'); 

    $("#divDialog1").dialog({ 
     dialogClass: 'notitle', 
     modal: true, 
     zIndex: 10002, 
     resizable: false, 
     closeOnEscape: false, 
     open: function (event, ui) { 
      $(".ui-dialog-titlebar-close").hide(); 
     }, 
     buttons: { 

      "Ok": function() { 
       //Here I call another function which is an ajax call. 
       //when the ajax call is completed (success or not) I call 
       //another function which creates the second dialog with results 

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

//Function called after ajax call. creats a result dialog 
//This Dialog doesn't show in the middle of the screen 

function customAlertMessage(title, message) { 

var div = '<div style="text-align:center;" title="' + title + '">' + message + '</div>' 
$(div).dialog({ 
    resizable: false, 
    dialogClass: 'notitle', 
    modal: true, 
    buttons: { 
     "Ok": function() { 
      $(this).dialog("close"); 
     } 
    } 
}); 
} 
+0

어쩌면 코드를 게시 할 수 있습니까? – mituw16

+0

일부 예제 코드로 편집되었습니다. – jpgrassi

답변

0

를 엽니 다.

내 경우에는 내가 잘못하고있는 것이 이전 대화 상자를 닫지 않고 다른 대화 상자를 여는 것이라고 생각합니다. 내가 이것을 한 후에 문제가 해결되었습니다. 왜 이런 일이 일어나는지 확신 할 수 없습니다. 다른 설명이나 해결책은 환영합니다.

$(".btblock").click(function (event) { 

event.preventDefault(); 

var btn = $(this); 

var id= btn.attr('id'); 

$("#divDialog1").dialog({ 
    dialogClass: 'notitle', 
    modal: true, 
    zIndex: 10002, 
    resizable: false, 
    closeOnEscape: false, 
    open: function (event, ui) { 
     $(".ui-dialog-titlebar-close").hide(); 
    }, 
    buttons: { 

     "Ok": function() { 

      //Close First! 
      $(this).dialog("close"); 

      //Than call functions that open others dialogs     
     } 
    } 
}); 
}); 
관련 문제