2012-12-13 1 views
0

테이블의 항목을 나열하는 부트 스트랩 페이지가 있습니다. 각 항목에는 모달을 시작하는 자체 삭제 링크가 있습니다.트위터 부트 스트랩에서 주 버튼을 클릭 할 때 사용자 정의 콜백 URL 모달

<a href="#modalDel" data-idtodelete="<?php echo $value->id; ?>" class="deletelink"> 
Delete this item 
</a> 

... 

jQuery("a.deletelink").click(function(event){ 
    var id2del = $(this).data('idtodelete'); 
    jQuery("#myModalLabel").html("Delete item: "+id2del); //works great 
    jQuery('#modalDel').modal('show'); 
}); 

난 쉽게 모달 데이터를 전달 할 수 있지만, 지금은 동적 URL을 반영하고이 버튼을

어떤 아이디어를 클릭 할 때 (만) 그것에 전화를 모달의 주요 버튼을해야 ? 감사합니다.

추신 : 취소 버튼을 사용하여 모달을 숨길 수 있으므로 숨겨진 이벤트를 사용할 수 없습니다. 또한 모달은 dyn을 호출하기 전에/닫아야합니다. 기본 버튼의 URL 삭제

답변

1

나는 이것으로 추측 할 위험이있다. 내가 설정에 대해 잘 모르니까 테스트하지 않았다.

var $ = jQuery; // using as a shortcut 

$('#modalDel').on('show', 
     function() { 
      // Composes delete URL with arguments 
      var dynUrl = composeUrl(args); 
      // assuming the modal button is an anchor element 
      $('#modalButton').attr('href', dynUrl); 


      // Also closes the modal box after being clicked 
      $('#modalButton').on('click', 
       function(e) { 
        $('#modalDel').modal('hide'); 
       }); 

     }); 
관련 문제