如何在HubSpot(CMS)博客文章中编码jquery.dataTables

时间:2019-09-19 09:32:30

标签: jquery datatables hubspot hubspot-cms

我正在HubSpot中开发博客文章,内容之一是表格。我想到使用jquery.dataTables,但是,搜索所有列均不起作用。它仅在一列中搜索,并且不响应移动。

$(document).ready(function() {
  $('#example tfoot th').each(function() {
    var title = $(this).text();
    $(this).html('<input type="text" placeholder="Search ' + title + '" />');
  });

  var table = $('#example').DataTable();
  table.columns().eq(0).each(function(colIdx) {
    $('input', table.column(colIdx).footer()).on('keyup change', function() {
      table.column(colIdx).search(this.value).draw();
    });
  });
});

0 个答案:

没有答案
相关问题