DataTables未显示搜索,排序和过滤器

时间:2017-06-19 02:18:47

标签: javascript jquery css datatable

大家好,你能帮帮我解决这个问题吗?我在同一页面上有2种不同的模态。第一个模态显示搜索和过滤

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>

2 个答案:

答案 0 :(得分:0)

您使用的第一个模态$('#second').DataTable();

您未使用img{ max-width: 420px !important; max-height: 270px !important; width:100% display: block !important; position: relative !important; }

的第二个模态

所以,你必须添加第二个模态。

答案 1 :(得分:0)

表格应具有不同的ID。例如:

def merge(dictF):

#create two new dict 
   M_12_merge ={}
  abc_merge={}
  for key in dictF:
      M_12_merge[key]={}
      abc_merge[key]={}
  for key in dictF:
      for subKey in dictF[key]:
          M_12_merge[key][subKey]={}

  for rekey in M_12_merge:
      for sub_rekey in M_12_merge[rekey]:
          M_12_merge[rekey][sub_rekey]['M']=[]

# 1. merge sub_sub_key 'M1' and 'M2' under different keys
  for key in dictF:
      for sub_key in dictF[key]:
          numberList=[]
          for sub_sub_key in dictF[key][sub_key]:
              if 'M' in sub_sub_key:
                  numberList.append(dictF[key][sub_key][sub_sub_key])
              else:
                  M_12_merge[key][subKey][sub_sub_key]=dictF[key][sub_key][sub_sub_key]
          M_12_merge[key][sub_key]['M']=map(sum,zip(*numberList))      

# 2. merge sub_key 'a','b' and 'c' under same keys
  for key in M_12_merge:
      for sub_key in M_12_merge[key]:
          for sub_sub_key in M_12_merge[key][sub_key]:
              if sub_sub_key in abc_merge[key]:
                  abc_merge[key][sub_sub_key] = [sum(x) for x in zip(*[abc_merge[key][sub_sub_key], M_12_merge[key][sub_key][sub_sub_key]])]
              else:
                  abc_merge[key][sub_sub_key] = M_12_merge[key][sub_key][sub_sub_key]                
  return abc_merge


dic = merge(dicA) 
print(dic)