2017-06-19 82 views
-1

你好,你可以幫我解決這個問題嗎?我在同一頁面上有兩種不同的模式。第一個模式顯示的搜索和過濾DataTables不顯示搜索,排序和篩選

click to view first modal

但其他情態動詞不能顯示任何東西,只有 enter image description here

<script src="https://cdn.datatables.net/1.10.13/js/dataTables.bootstrap.min.js"></script> 
    <script src="https://cdn.datatables.net/responsive/2.1.1/js/dataTables.responsive.min.js"></script> 
    <script src="https://cdn.datatables.net/responsive/2.1.1/js/responsive.bootstrap.min.js"></script> 
    <script type="text/javascript"> 
     $(document).ready(function() { 
     $('#example').DataTable(); 
     $('.modal-child').on('show.bs.modal', function() { 
      var modalParent = $(this).attr('data-modal-parent'); 
      $(modalParent).css('opacity', 0); 
     }); 

     $('.modal-child').on('hidden.bs.modal', function() { 
      var modalParent = $(this).attr('data-modal-parent'); 
      $(modalParent).css('opacity', 1); 
     }); 


    }); 
    </script> 
+0

您可以提供所有HTML代碼的工作模式嗎?它可以幫助我們調試你的問題並給你一個更好的答案。 –

+0

你使用的是API嗎?還要檢查表格標題。我認爲你在顯示你的表格數據時遇到了問題..你的第二張桌子上沒有表格標題。檢查表格ID。在某些情況下,重複的表格ID可能不起作用。 –

回答

0

第一模態您使用$('#example').DataTable();

內容

你是第二個模態沒有使用$('#second').DataTable();

所以,你必須添加第二個模態。

0

表應該有不同的ID。例如:

<script type="text/javascript"> 
    $(document).ready(function() { 
    $('#table1').DataTable(); 
    $('#table2').DataTable(); 
    }); 
</script> 
... 
<table id="table1" class="display" cellspacing="0" width="100%"> 
... 
<table id="table2" class="display" cellspacing="0" width="100%">