numeric rows in tables

7 views
Skip to first unread message

John froeschke

unread,
Nov 30, 2017, 1:26:56 PM11/30/17
to Shiny - Web Framework for R
I have a small table that I would like to update based on user input values for each row.  I found an example of how to create the input side here: https://stackoverflow.com/questions/22221089/insert-a-numeric-input-for-each-row-r-shiny

However, I can't seem grab the input values necessary to update the table.  An simple example (adapted from the link I included) is below.  Any help greatly appreciated.


shiny::runApp(list(
  ui = basicPage(
    tableOutput("My_table")
  ),
  server = function(input, output, session) {
    
    My_table = matrix( 
      1:3, 
      nrow=3, 
      ncol=1)
    output$My_table <- renderTable({
      input1 <- paste0("<input id='a", 1:nrow(My_table), "' class='shiny-bound-input' type='number' style='width: 50px;'>")
      input2 <- paste0("<input id='b", 1:nrow(My_table), "' class='shiny-bound-input' type='number' style='width: 50px;'>")
      cbind(input1, My_table, input2)
    }, sanitize.text.function = function(x) x)
    
  }
))
Reply all
Reply to author
Forward
0 new messages