Quantcast
Channel: Shiny DT datatable Make only certain columns editable by the user - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Shiny DT datatable Make only certain columns editable by the user

$
0
0

A simple app:

## This is a Shiny web application. You can run the application by clicking# the 'Run App' button above.## Find out more about building applications with Shiny here:##    http://shiny.rstudio.com/#library(shiny)# Define UI for application that draws a histogramui <- fluidPage(    # Application title    titlePanel("blah"),    # Sidebar with a slider input for number of bins     sidebarLayout(        sidebarPanel(),        # Show a plot of the generated distribution        mainPanel(            DT::DTOutput('ex_df')        )    ))# Define server logic required to draw a histogramserver <- function(input, output) {    output$ex_df <- DT::renderDT(data.frame(        x = 1:10,        y = 1,        z = 11:20    ),     selection = 'none', editable = 'cell', server = TRUE, rownames = FALSE,    list(target = 'cell', disable = list(columns = c(1,2)))    )}# Run the application shinyApp(ui = ui, server = server)

With this line: disable = list(columns = c(1,2) I intended to make the 1st and second column un editable. However, all columns seem to be editable:enter image description here

How can I set it so that only the 3rd column is editable?


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>