数据表固定列(仅右)发行 [英] Datatable Fixed Column (Right Only) Issue

查看:72
本文介绍了数据表固定列(仅右)发行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JQuery Datatable,并且在使用固定列时遇到了问题. 它已经显示了两次我的固定列

I'm using JQuery Datatable and I ran into a problem when I used fixed column. It has been showing two times my fixed column

我正在使用服务器端处理,这是我的代码:

I'm using serverside processing and that's my code:

dataTable = table.dataTable({
            fixedColumns:   {
                leftColumns: 0,
                rightColumns: 1
            },
            scrollX:true,
            scrollCollapse: true,
            "fnDrawCallback":function(oSettings) {
                $('div.choosePage select').val(dataTable.DataTable().page());
            },
            "pagingType":"bootstrap_full_number",
            "processing": true,
            "serverSide": true,
            "ajax": {
             "data":GETDATA,
             "dataSrc":SETAJAXDATA
            },
            "fnInitComplete":completeProcess,
            "colReorder": true,
            "order": [
            [0, 'asc']
            ],
            "dom": "<'row' <'col-md-12'>><'row'<'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-4 col-sm-12'i><'col-md-5 col-sm-12 toolbar'p><'col-md-push-1 col-md-3 col-sm-12 toolbar choosePage'>>", // horizobtal scrollable datatable
        })

Ajax运行良好,当我在左侧使用固定列时没有问题,但是当我在右侧使用固定列时,我遇到了这个问题.

Ajax is working good and there is no problem when I used fixed column on left side,but when I used it on right side i'm running into this problem.

谢谢.

推荐答案

如果您尚未从选项中设置scrollY,我相信这是Jquery Datatable中的错误,请确保设置了一些值.

I believe it is a bug in Jquery Datatable if you haven't setup scrollY from the options, make sure you set some value.

因为当您检查元素时,您可以看到Scroll-y溢出是自动的.如果将其设置为隐藏或未从选项中设置值,那么您将看到右侧的空间.

Because when you inspect the element you can see scroll-y overflow is auto. If you set it as hidden or not setup a value from the options, there you go, you see the space at the right side.

如果您根本不想使用scroll-y,那么您需要通过提供一些较小的边距来用一些css代码弄脏您的手,这是一个丑陋的解决方案.但是我看不到其他选择.

Incase you do not want to use scroll-y at all, then you need to make your hands dirty with some css code by giving some minor margin which is an ugly solution. But I cannot see any other option for you.

这对于Jquery数据表插件是一种耻辱.

It's a shame for Jquery datatable plugin.

下面显示了来自插件网站的示例选项列表.

Below shows an example option list from the plugin website.

$(document).ready(function() {
    var table = $('#example').DataTable( {
        scrollY:        "300px",
        scrollX:        true,
        scrollCollapse: true,
        paging:         false,
        fixedColumns:   {
            leftColumns: 0,
            rightColumns: 1
        }
    } );
} );

这篇关于数据表固定列(仅右)发行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆