问题
How do I remove all the horizontal borders to just the even/odd shading?
https://datatables.net/examples/styling/stripe.html
This doesn't work.
table.dataTable.row-border tbody th,
table.dataTable.row-border tbody td,
table.dataTable.display tbody th,
table.dataTable.display tbody td {
border: none;
}
I would also like to remove the top and bottom black borders. This doesn't seem to have any effect.
table.dataTable thead th {
border-bottom: 0;
border-style: none;
}
table.dataTable tfoot th {
border-top: 0;
border-style: none;
}
table.dataTable .no-footer {
border-bottom: 0;
}
回答1:
You can use the following code to remove all the horizontal borders to just the even/odd shading:
datatable(mtcars[1:3,1:3], class = 'stripe')
回答2:
You can remove the top border and the bottom border like this:
datatable(head(iris),
options=list(headerCallback = JS(
"function( thead, data, start, end, display ) {
$(thead).closest('thead').find('th').each(function(){
$(this).css('color', 'red').css('border','none');
});
}"
),
initComplete = JS(
"function(settings) {
var table = settings.oInstance.api();
$(table.table().node()).removeClass('no-footer');
}")))
来源:https://stackoverflow.com/questions/52248958/datatable-remove-all-horizontal-borders