Below is the shiny application where there is a DT table
library(shiny)
library(DT)
ui <- fluidPage(
br(),
splitLayout(
DTOutput("dtable1"),
DTOutput("dtable2")
)
)
js <- function(id){
c(
"table.on('click', 'tr', function(){",
sprintf("Shiny.setInputValue('%s', true, {priority: 'event'});", id),
"});"
)
}
server <- function(input, output, session){
output[["dtable1"]] <- renderDT({
datatable(iris['Sepal.Length'], callback = JS(js("t1")), selection = 'single')
})
}
shinyApp(ui, server)
So when the user clicks on any row, the remaining columns details be occur. For example in this case they are Sepal.Width, Petal.Length, Petal.Width, Species.
I know we can add another DT table below and do this. But is there a way to do this same table. I just need the contents of the remaining columns with the respect to the rows selected.
below is the similar way I am looking for . This is just a sample, but this the format i am looking for. Basically a HTML table with remaining values.
Right now the DT table has only 1 column Sepal.Length
. Now when the user clicks on 1st row, the remaining columns of the 1st row other than Sepal.Length
should be shown below in the form of HTML table(like the one in the picture above). So basically similar to input$dtable1_rows_selected
feature in DT table.