You are trying to do something quite complicated, it requires js callbacks in DT and use of bind and unbind etc.
Here is an example
library(shiny)
library(DT)
shinyApp(
ui <- fluidPage(
title = 'Slider Inputsa table',
DT::dataTableOutput('foo'),
verbatimTextOutput('sel')
),
server <- function(input, output, session) {
m <- matrix(
1:12, nrow = 12, ncol = 1, byrow = TRUE,
dimnames = list(month.abb, "initial_slider_values")
)
m2 <- m
for (i in seq_len(nrow(m))) {
m2[i, ] <-selectInput(inputId = month.abb[i],
label = month.abb[i],
choices = c(m[i, ],m[i, ]-1),
selected = m[i,]) %>% as.character
}
m2
output$foo = DT::renderDataTable(
m2, escape = FALSE, selection = 'none', server = FALSE,
options = list(dom = 't', paging = FALSE, ordering = FALSE),
callback = JS("table.rows().every(function(i, tab, row) {
var $this = $(this.node());
$this.attr('id', this.data()[0]);
$this.addClass('shiny-input-slider-input');
});
Shiny.unbindAll(table.table().node());
Shiny.bindAll(table.table().node());")
)
output$sel <- renderPrint({
str(sapply(month.abb, function(i) input[[i]]))
})
}
)
I adapted this from
Radio buttons in a table (shinyapps.io)