如何解决数据表中的设计问题

How to fix design issue in data table

提问人:REVATHI 提问时间:10/29/2023 最后编辑:REVATHI 更新时间:10/31/2023 访问量:46

问:

我有带有列搜索的 JQuery 数据表。当我按 Tab 键时,我的表头在移动,但表体没有移动。 下面是我的代码。

 
        
var table=$('#example').DataTable({
         // stateSave: true
          "ordering": false,
          "retrieve": true,
          "fixedHeader": true,
           "scrollX": true,
            // "fixedColumns": {
            //    left: 1
            //  },  

        
              scrollY: '600px',
            dom: 'lBfrtip',
            buttons: [
            {
                extend: 'excel',
                text: 'Export',
                title:'Aluminum Coil Production Tracking Entries',
                className: 'btn btn-primary',
                header: true,
                exportOptions: {
                    //columns: ':visible:not(.notexport)'
                    //columns: [':visible', 16,18,19 ]
                     columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
                }
            }],
           
           
         });
        
         // Apply the search
    table.columns().every( function () {
        var that = this;
 
        $( 'input', this.header() ).on( 'keyup change', function () {
            
            if ( that.search() !== this.value ) {
                that.search( this.value )
                    .draw();
            }
        } );
    } );

我遇到了像屏幕截图一样的设计问题

enter image description here

htmlcode

徽章编号 名字 完成时间 类别
JavaScript jQuery 数据表

评论

1赞 KIKO Software 10/29/2023
请注意,您的问题中缺少您的表格 HTML。请参阅:如何创建最小的可重现示例。另外,不要忘记测试您在问题中输入的实际代码
0赞 REVATHI 10/30/2023
如何解决该问题?
0赞 gretakava 10/30/2023
@REVATHI,你有HTML代码吗?它只是添加了 JS 部分和屏幕截图 - 此时无法复制和解决。

答: 暂无答案