dt

R DT Horizontal scroll bar at top of the table

◇◆丶佛笑我妖孽 提交于 2021-02-18 12:32:14
问题 I have a wide and lengthy DT in shiny. By default I would like to show the horizontal scroll bar on top of the table. Is there a way to do this? My current DT definition looks like below: DT::datatable(dt, rownames = FALSE, filter = fbox, style = "bootstrap", options = list( dom = dom, scrollX = TRUE, columnDefs = list(list(orderSequence = c('desc', 'asc'), targets = "_all")), processing = FALSE, pageLength = 500, lengthMenu = list(c(500, 1000, 5000), c("500","1000","5000")) ), callback = DT:

R DT Horizontal scroll bar at top of the table

ぐ巨炮叔叔 提交于 2021-02-18 12:31:44
问题 I have a wide and lengthy DT in shiny. By default I would like to show the horizontal scroll bar on top of the table. Is there a way to do this? My current DT definition looks like below: DT::datatable(dt, rownames = FALSE, filter = fbox, style = "bootstrap", options = list( dom = dom, scrollX = TRUE, columnDefs = list(list(orderSequence = c('desc', 'asc'), targets = "_all")), processing = FALSE, pageLength = 500, lengthMenu = list(c(500, 1000, 5000), c("500","1000","5000")) ), callback = DT:

R Shiny - Pre-selection of rows in Select extension for Datatables

ε祈祈猫儿з 提交于 2021-02-11 18:08:05
问题 How can I pre-select rows with the Select extension for Datatables in Shiny? I've checked the documentation here: https://datatables.net/extensions/select/. But I can't figure it out. I tried specifying rows = 1:3 but that didn't have any effect: library(DT) library(shiny) dat <- iris[1:17,] shinyApp( ui = fluidPage(DTOutput("table")), server = function(input, output, session) { output[["table"]] <- renderDT({ datatable( dat, options = list(select = list( style = "multi", rows = 1:3, selector

R Shiny - Pre-selection of rows in Select extension for Datatables

做~自己de王妃 提交于 2021-02-11 18:06:15
问题 How can I pre-select rows with the Select extension for Datatables in Shiny? I've checked the documentation here: https://datatables.net/extensions/select/. But I can't figure it out. I tried specifying rows = 1:3 but that didn't have any effect: library(DT) library(shiny) dat <- iris[1:17,] shinyApp( ui = fluidPage(DTOutput("table")), server = function(input, output, session) { output[["table"]] <- renderDT({ datatable( dat, options = list(select = list( style = "multi", rows = 1:3, selector

Datatable displays empy selectInput while values are selected by default

删除回忆录丶 提交于 2021-02-11 15:43:39
问题 I have the shiny app below in which I pass the values of a list with characters inside a selectImput() but while all those values seem to be selected (and they should be) by checking their count in the third column the selectize inputs seem to be empty. I think that for this issue is responsible the list words I created. library(shiny) library(DT) library(jsonlite) selector <- function(id, values, items = values){ options <- HTML(paste0(mapply( function(value, item){ as.character(tags$option

Using values from slider in javascript DataTables calculations

隐身守侯 提交于 2021-02-11 14:39:45
问题 I've got a nested DataTable in my shiny app that is made from the data below. There are two sliders that I have which make up a percentage of 100. If one slider is 50 the other sider is 50. These two numbers from the two sliders help make up the Spot:30(%) and the Spot:15(%) columns of the child table. There is another column, Mix(%) , where the user is able to go in and edit the numbers. When the user edits this column the numbers in the Spot:30(%) and the Spot:15(%) columns are suppose to

Combining renderUI, dataTableOutput, and renderDataTable

孤者浪人 提交于 2021-02-11 14:17:23
问题 Suppose I have the following shiny app that renders a data table from the package DT: library(shiny) ui <- fluidPage(uiOutput("abc")) server <- function(input, output, session) { output$abc <- renderUI({DT::dataTableOutput("dt_output")}) # line 4 output$dt_output <- DT::renderDataTable({data.table(a = 1:3, b = 4:6)}) # line 5 } runApp(list(ui = ui, server = server)) How would you combine lines 4 and 5, with the constraint that output$abc must remain a uiOutput ? My attempt at combining (the

Delete DataTable rows in Shiny app using Javascript

血红的双手。 提交于 2021-02-11 12:47:32
问题 I'm trying to remove rows from a Datatable in a Shiny app using Javascript. In the table I have a column with a "delete" button for each row. This would be more or less what I'm trying to do, but I can't get it to work. In my server.R: initComplete <- DT::JS( "function () {", " var table = this.api();", " $('#delete_button').on('click', function() {", " table.row($(this).parents('tr')).remove().draw();", " });", "}" ) shinyInput <- function(FUN, len, id, ...) { inputs <- character(len) for (i

Delete DataTable rows in Shiny app using Javascript

一笑奈何 提交于 2021-02-11 12:47:31
问题 I'm trying to remove rows from a Datatable in a Shiny app using Javascript. In the table I have a column with a "delete" button for each row. This would be more or less what I'm trying to do, but I can't get it to work. In my server.R: initComplete <- DT::JS( "function () {", " var table = this.api();", " $('#delete_button').on('click', function() {", " table.row($(this).parents('tr')).remove().draw();", " });", "}" ) shinyInput <- function(FUN, len, id, ...) { inputs <- character(len) for (i

Embed column with mixed numericInput and selectInput in DT

冷暖自知 提交于 2021-02-11 12:29:27
问题 I would like to add a column to a DT that accepts either selectInput or numericInput, depending on the variable. For example, given the following DF: df1 <- tibble( var1 = sample(letters[1:3],10,replace = T), var2 = runif(10, 0, 2), id=paste0("id",seq(1,10,1)) ) DF=gather(df1, "var", "value", -id) I would like to create an extra col in the DF (using DT ), with selectInput for var1 (choices= letters[1:3]) and numericInput for var2 . I have found here a great example for implementing