datatables show double order icon on header

扶醉桌前 提交于 2019-12-24 13:52:39

问题


I'm creating a simple table using datatables with bootstrap with this instructions

var bTable = $('#example2').DataTable( {
        language: {  url: 'assets/plugins/datatables/i18n/Spanish.json'     },
        processing: true,
        fixedHeader: true,
        serverSide: true,
        responsive:true,
        ajax: "modulos/estados.data.php",
        columns: [
            { data: "id561" },
            { data: "des561" },
            { data: "accion561" },
            { data: "res561" }
        ],
        order: [[ 1, "asc" ]],
        columnDefs: [
            {
                targets : 0,
                searchable: false,
                render: function ( data, type, row ) 
                { return row.id561 }
            },
            {
                targets : 1,
                searchable: true,
                render: function ( data, type, row ) 
                { return data }
            },
            {
                targets : 2,
                searchable: false,
                render: function ( data, type, row ) 
                { return data }
            },
            {
                targets : 3,
                orderable: false,
                searchable: false,
                render: function ( data, type, row ) 
                { return data }
            }
        ]
    } );

The problem is that its show on header the order icon twice as shown on image

the problem is only activating Bootstrap css, if I use jquery its works

Thanks for help!


回答1:


Make sure that you're not including DataTables CSS file (jquery.dataTables.min.css), only dataTables.bootstrap.min.css.

If you're using Download Builder, select Bootstrap in the Styling section. If you already have Bootstrap included, chose No styling library, otherwise chose Include library to include the latest Bootstrap as well.

See this example for demonstration of correct usage.




回答2:


Do this...

table.dataTable thead .sorting_asc, .sorting_desc, .sorting {
    background-image: none !important;
}


来源:https://stackoverflow.com/questions/34773857/datatables-show-double-order-icon-on-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!