DataTable: Remove all horizontal borders

2019-07-29 06:34发布

How do I remove all the horizontal borders to just the even/odd shading?

enter image description here

https://datatables.net/examples/styling/stripe.html

enter image description here

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;
}

标签: r dt
2条回答
Evening l夕情丶
2楼-- · 2019-07-29 06:48

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');
            }"))) 
查看更多
虎瘦雄心在
3楼-- · 2019-07-29 07:09

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')

enter image description here

查看更多
登录 后发表回答