Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

137
Views
Round borders with DT datatables in R

I would like round borders on my DT table. Unfortunately my JS skills are very limited (or even inexistent) thus I would be very happy if somebody could help me to figure out how to implement round borders on a DT table in R.

This is my code so far:

DT::datatable(
  data = iris,
  options = list(
    initComplete = DT::JS(
      "function(settings, json) {",
      paste0(
        "$(this.api().table().header()).css({
          'background-color': 'black',
          'color': 'white',
          'border-top-left-radius': '4px',
          'border-top-right-radius': '4px'
          });"
      ),
      "}"
    )
  )
)

The last part border-top-left-radius does not work but something like this would be the solution. I think this answer has the solution in pure JS but I need somebody to help me to implement this snippet in my R code.

Here is a screenshot from my code. Now I would like to have the top left and right border with a radius. As you can see the border is 90 degrees at the moment.

still with pointy borders

7 months ago · Juan Pablo Isaza
1 answers
Answer question

0

You have to use overflow: hidden.

DT::datatable(
  data = iris,
  options = list(
    initComplete = DT::JS(
      "function(settings, json) {",
      paste0(
        "$(this.api().table().header()).css({
          'background-color': 'black',
          'color': 'white',
          'border-top-left-radius': '4px',
          'border-top-right-radius': '4px', 
          'overflow': 'hidden'
          });"
      ),
      "}"
    )
  )
)
7 months ago · Juan Pablo Isaza Report
Answer question
Find remote jobs