Underlying values in DT table

Hi all,

Is there a way to underline values in DT table . Example

=library(shiny)
library(DT)

ui <- fluidPage(
  dataTableOutput("iris")
)

server <- function(input, output, session) {
  output$iris <- renderDataTable(datatable(head(iris)))
}

shinyApp(ui, server)

In the above application, is there a way to underline any values ? (example value (2,3) , meaning 2nd row and 3rd column value)

library(shiny)
library(DT)
library(formattable)
library(dplyr)

ui <- fluidPage(
  dataTableOutput("iris")
)

server <- function(input, output, session) {
  newdata_raw <- head(iris)
  new_data_formatted <- formattable(newdata_raw, list(
    Petal.Length = formatter("span",
      style = function(x) {
        ifelse(dplyr::row_number(x) == 3,
          "text-decoration: underline;",
          NA        )
      }))) %>% as.datatable()

  output$iris <- renderDataTable( new_data_formatted)
}

shinyApp(ui, server)

but its all underlined... you've done it.

Great thanks. But actually there was additional need and i tried myself to arrive at. So basically entire 3rd row should be underlined and not only texts. Below code is underlying only text (Can we do entire row?)

library(shiny)
library(DT)
library(formattable)
library(dplyr)

ui <- fluidPage(tags$style(HTML('#iris tbody>tr:nth-child(3){
 text-decoration: underline;
}')),
  dataTableOutput("iris")
)

server <- function(input, output, session) {
  newdata_raw <- head(iris)
  output$iris <- renderDataTable(datatable(newdata_raw,escape = F))
}

shinyApp(ui, server)

best I can do, if you find something better let me know.
Probably most likely to get the best help from HTML/CSS experts , perhaps theres a forum for that.


library(shiny)
library(DT)

ui <- fluidPage(
  dataTableOutput("iris"),
  tags$style(HTML("#iris tbody>tr:nth-child(3){
 border-bottom:5px solid red;
}
#iris table.dataTable {
    border-collapse: collapse;
"))
)

server <- function(input, output, session) {
  newdata_raw <- head(iris)
  output$iris <- renderDataTable(datatable(newdata_raw,escape = F))
}

shinyApp(ui, server)

Thanks for the reply. Yeah it is underlined. But only below the text. So wanted to check if we can underline entire row (throughout 3rd row).

PLease let me know if I confused you. The line to be throughout 3rd row :slight_smile: (not just below texts)

Awesome. Genius you are :slight_smile: