将()值传递到DT的javascript部分

将()值传递到DT的javascript部分,javascript,r,shiny,dt,flexdashboard,Javascript,R,Shiny,Dt,Flexdashboard,我想将一个反应值传递到DT库的选项中的rowCallback中。请参见下面的示例。我在flexdashboard中使用它,它具有闪亮的运行时 设立 --- title: "Untitled" output: flexdashboard::flex_dashboard: orientation: columns vertical_layout: fill horizontal_layout: fill runtime: shiny --- ```{r set

我想将一个反应值传递到DT库的选项中的rowCallback中。请参见下面的示例。我在flexdashboard中使用它,它具有闪亮的运行时

设立

---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    horizontal_layout: fill
runtime: shiny    
---

```{r setup, include=FALSE}
library(flexdashboard)
library(DT)
library(shiny)
library(shinyjs)
```

Column
-----------------------------------------------------------------------
带有静态值的表,截止值=4。正在工作

### Chart A

```{r,eval=T}
output$mtcarsTable1 <- renderDataTable({
      DT::datatable(datasets::mtcars, 
      options = list( pageLength = 5,
                      searching= FALSE,
                      lengthChange = FALSE,
                      ordering=FALSE,
                      rowCallback = JS('
            function(nRow, aData, iDisplayIndex, iDisplayIndexFull,cutoff=4) {
                                      // Bold and green cells for conditions
                                      if (parseFloat(aData[10]) >= cutoff)
                                      $("td:eq(4)", nRow).css("font-weight", "bold");
                                       }')))
    })
dataTableOutput('mtcarsTable1')

```
图A ```{r,eval=T}
输出$mtcarsTable1从这里得到了答案

需要在单引号和works中设置带有输入值的行

function(nRow, aData, iDisplayIndex, iDisplayIndexFull, cutoff = ',input$gearvalue,') 
function(nRow, aData, iDisplayIndex, iDisplayIndexFull, cutoff = ',input$gearvalue,')