问题
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