Format a vector of rows in italic and red font in R DT (datatable)

后端 未结 3 854
执念已碎
执念已碎 2020-12-11 13:07

A bit similar to this question: How to give color to a given interval of rows of a DT table?

but in my case I would like to let the user select rows in the table, th

3条回答
  •  时光说笑
    2020-12-11 13:45

    Here is an attempt.

    library(shiny)
    library(DT)
    
    rowCallback <- function(rows){
      c(
        "function(row, data, num, index){",
        sprintf("  var rows = [%s];", paste0(rows-1, collapse = ",")),
        "  if(rows.indexOf(index) > -1){",
        "    for(var i=1; i% selectRows(NULL)
      })
    
    }
    
    shinyApp(ui, server)
    

提交回复
热议问题