首页 > 解决方案 > Colvis 不显示任何列

问题描述

 schedule_Open_Datatable = $("#make_schedule_open_table").DataTable({
    columnDefs: [
      { className: "control", orderable: false, targets: 1, width: "5%" },
      { orderable: false, targets: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11] }
    ],
    responsive: {
      details: {
        type: "column",
        target: 1,
      },
    },
    //scrollX: true,
    buttons: ["copy", "csv", "excel", "pdf", "print", "colvis"],
    sPaginationType: "full_numbers",
    ajax: {
      url: SODUrl,
      // our data is an array of objects, in the root node instead of /data node, so we need 'dataSrc' parameter
      dataSrc: "",
    },
    columns: columns,
    rowReorder: { dataSrc: "seq" },
    order: [[0, 'asc']],
    dom: "<'row'<'col-sm-6'B><'col-sm-6'f>>" +
      "<'row'<'col-sm-12'tr>>" +
      "<'row'<'col-sm-4'l><'col-sm-4'i><'col-sm-4'p>>",
    select: "single",

    //ordering: false,
    createdRow: function (row, data, dataIndex) {
      $(row).attr("data-id", data.id);
    },

colvis 按钮存在于页面上,但它不想显示任何列,我有所有需要的链接,我尝试使用 bootstrap 4 页面上使用的示例,但仍然无法正常工作。

标签: javascriptbootstrap-4datatable

解决方案


推荐阅读