移动时列偏移 - colReorder Datatable

Column shift when moving - colReorder Datatable

提问人:TheoB 提问时间:12/9/2022 更新时间:12/9/2022 访问量:77

问:

我正在尝试在DataTable JS中实现“colReorder”选项。 以下是表声明: `

var dataTable = $('#table_taches').DataTable({
    "lengthChange": true, "autoWidth": true, "sScrollX": "150%",
    "sScrollXInner": "150%",
    "scrollY": 420,
    "bScrollCollapse": false,
    colReorder: {
        fixedColumnsLeft: 1,
        realtime: false
    },
    columns: [
    { data: "0" },
    { data: "1" },
    { data: "2" },
    { data: "3" },
    { data: "4" },
    { data: "5" },
    { data: "6" },
    { data: "7" },
    { data: "8" },
    { data: "9" },
    { data: "10" },
    { data: "11" },
    { data: "12" },
    { data: "13" },
    { data: "14" },
    { data: "15" },
    { data: "16" },
    { data: "17" },
    { data: "18" },
    { data: "19" },
    { data: "20" },
    { data: "21" },
    { data: "22" },
    { data: "23" },
    { data: "24" },
    { data: "25" },
    { data: "26" },
    { data: "27" },
    { data: "28" },
    { data: "29" },
    { data: "30" },
    { data: "31" },
    { data: "32" },
    { data: "33" },
    { data: "34" },
    { data: "35" },
  ],

    "stateSave": false,
    "stateSaveCallback": function(settings,data) {
      localStorage.setItem( 'DataTables_' + settings.sInstance, JSON.stringify(data) )
    },
    "stateLoadCallback": function(settings) {
    return JSON.parse( localStorage.getItem( 'DataTables_' + settings.sInstance ) )
    },
    "processing" : true,
    "serverSide" : true,
    "order" : [],
    "ajax" : {
     url: "<?php echo base_url();?>/config/taches/fetch.php",
     type:"POST"
    },
    "oLanguage": {
      "sSearch": "Recherche globale"
    },
    "pageLength" : 5,
    "lengthMenu": [ 5, 25, 50, 75, 100, 200, 500],
    "columnDefs": [ {
      "targets": 0,
      "orderable": false
    } ]
   });

`

当我尝试移动我的一列时,只有标题跟随。表中的值不如下: 在此处输入图像描述 看起来有一列的偏移量。

如何解决此问题? 谢谢!

在 DataTable + StackOverFlow 论坛上搜索所有可用选项。

javascript jquery ajax 数据表

评论


答: 暂无答案