dt

In Shiny, update DataTable with new values from user input

萝らか妹 提交于 2019-12-04 12:06:23
I'm writing a shiny app that has a table (using DT::renderDataTable ) from which users can select a row. But I want the user to also be able to add new row(s) if what they want is not already in the table. I'm using input controls for the user to enter new data, and I have an action button which, if pressed, should create a new row of data in the table from the input values. But pressing the button does not update the table. A minimal example: library(shiny) library(DT) mydata = data.frame(id=letters[1:5], val=sample(10,5,T)) ui = fluidPage(dataTableOutput("table"), textInput('NewID', 'Enter

How To Add totals to a DT::datatable?

十年热恋 提交于 2019-12-04 09:42:40
I am trying to add totals to a data table footer. Using code from different sources, I wrote the following application using Shiny. The problem is, when I run it, the following message appears: "Processing ..." and stays there forever. My guess is the JS() code, but cannot debug that. library(shiny) library(DT) library(htmltools) ui <- fluidPage( fluidRow( column(9, DT::dataTableOutput('withtotal')) ) ) server <- function(input, output, session) { # server-side processing mtcars2 = mtcars[, 1:8] #sketch <- htmltools::withTags(table(tableHeader(mtcars2), tableFooter(mtcars2))) sketch =

R Shiny: How to add data tables to dynamically created tabs

二次信任 提交于 2019-12-04 03:30:03
I am currently trying to create dynamically-created data tables that each have its own tab. The number of tabs is determined by the user. I have used the code from this post as a framework. I am able to create the tabs dynamically, but I can't figure out how to add data tables to the tabs. The data tables are determined by user input too. So, for example, say in ui.R, the user has the choice to pick which data sets they want to see: ui.R library(shiny) shinyUI(fluidPage( titlePanel("Example"), sidebarLayout( sidebarPanel( selectInput("decision", label = "Choose Dataset", choices = list("mtcars

Highlight Predefined Words in Shiny DT table [Not through Search Highlight] [closed]

 ̄綄美尐妖づ 提交于 2019-12-03 21:45:23
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm creating a shiny application and I want to highlight certain predefined words in DT table in shiny. I'm aware of the search highlight feature in DT. For example: datatable(mtcars2, options = list(searchHighlight = TRUE, search = list(search = 'da'))) I want to highlight like the previous example but not from a search . For say, in mtcars data, I want to highlight words 'Merc', 'Fiat', 'Honda'

Adding a vertical and horizontal scroll bar to the DT table in R shiny

孤者浪人 提交于 2019-12-03 21:24:17
Please check the data table "Case Analyses Details" on the right. I want to fit the data table within the box, such that it aligns from right and bottom border in the box, such that we add a horizontal and vertical scroll bar to the DT which can be used to span the rows that overshoot the box. ## app.R ## library(shiny) library(shinydashboard) library(DT) ui <- dashboardPage( dashboardHeader(title = "My Chart"), dashboardSidebar( width = 0 ), dashboardBody( box(title = "Data Path", status = "primary",height = "595" ,solidHeader = T, plotOutput("trace_plot")), box( title = "Case Analyses

changing font size in R DataTables (DT)

对着背影说爱祢 提交于 2019-12-03 12:03:37
问题 Have been trying to change the font size of all text in the tables generated by DT. However, I could only figure out how to change the size of the records using formatStyle(names(datCalc), fontSize = '12px') . The column headers and buttons have text of the same size. Using R Markdown in RStudio. 回答1: I think you almost got there. I solved it by explicitly telling DT::formatStyle() which columns I wanted. I first tried using the names() or colnames() approach, as you did. For some reason this

Determine if DT datatable is clicked in shiny app

孤者浪人 提交于 2019-12-03 08:35:32
Here is a working example of my best attempt to get table click event: library(shiny) library(DT) runApp(shinyApp( ui = fluidPage(DT::dataTableOutput('table')), server = function(input, output, session) { output$table <- DT::renderDataTable({ dt <- data.frame(a = 1) datatable(dt, rownames = FALSE, selection = 'none') }) observeEvent(input$table_cell_clicked, { print(Sys.time()) })} )) The problem is that observeEvent reacts only if user clicks on the cell which differs from previously clicked. Is there a way to get event on any table click? I think it s may be helpful Try add callback with

Column alignment in DT datatable

老子叫甜甜 提交于 2019-12-03 06:32:45
问题 In my shiny app I am using datatable function from DT library to construct a table and want to align columns on center. I can use formatStyle('column', textAlign = 'center') but it affects only column body and not the header. 回答1: You have to set columnDefs in the argument option of the function datatable . Look the example below library(DT) datatable(head(iris), rownames = FALSE, options = list( columnDefs = list(list(className = 'dt-center', targets = 0:4)) )) OBS. You have to set the

changing font size in R DataTables (DT)

北战南征 提交于 2019-12-03 02:31:27
Have been trying to change the font size of all text in the tables generated by DT. However, I could only figure out how to change the size of the records using formatStyle(names(datCalc), fontSize = '12px') . The column headers and buttons have text of the same size. Using R Markdown in RStudio. I think you almost got there. I solved it by explicitly telling DT::formatStyle() which columns I wanted. I first tried using the names() or colnames() approach, as you did. For some reason this didn't work: iris %>% DT::datatable() %>% DT::formatStyle(columns = colnames(.), fontSize = '50%') However,

DataTable: Hide the Show Entries dropdown but keep the Search box

本秂侑毒 提交于 2019-12-03 00:33:55
问题 Is it possible to hide the Show Entries dropdown but keep the Search box in DataTable? I want to always display 10 rows with pagination at the bottom along with search box but do not want to display the Show entries dropdown. 回答1: You can find more information directly on this link: http://datatables.net/examples/basic_init/filter_only.html $(document).ready(function() { $('#example').dataTable({ "bPaginate": false, "bLengthChange": false, "bFilter": true, "bInfo": false, "bAutoWidth": false