daattali / colourpicker

🎨 A colour picker tool for Shiny and for selecting colours in plots (in R)
https://daattali.com/shiny/colourInput/
Other
217 stars 28 forks source link

updateColourInput not updating values that are initially NULL #8

Closed bklingen closed 7 years ago

bklingen commented 7 years ago

This might be related to #7, but maybe not. Trying to update a value that initially was set to NULL doesn't work. Below, the label is initially NULL, but updating it with updateColourInput doesn't work. However, if you set the initial label to something else in colourInput (i.e., an empty string ""), then updating works.

library(shiny)
library(colourpicker)
ui <- fluidPage(
  colourInput("mycol", label=NULL, value="#FFED6F", showColour="both")
)

server <- function(input, output, session) {
    updateColourInput(session, "mycol", label="Color 1")
}

shinyApp(ui = ui, server = server)
daattali commented 7 years ago

This is actually a problem with shiny, that I myself file quite a long time ago! https://github.com/rstudio/shiny/issues/868

I treat labels the same way any other shiny input does (because I really tried to make colourInput behave identically to native shiny inputs), so it also unfortunately carries this bug along. Since every other shiny input has this bug, I'm not going to devote time to fixing it for this specific input

bklingen commented 7 years ago

Great, thanks, I suspected as much but did not search for it as I should have.

On 3/1/2017 4:55 PM, Dean Attali wrote:

This is actually a problem with shiny, that I myself file quite a long time ago! rstudio/shiny#868 https://github.com/rstudio/shiny/issues/868

I treat labels the same way any other shiny input does (because I really tried to make colourInput behave identically to native shiny inputs), so it also unfortunately carries this bug along. Since every other shiny input has this bug, I'm not going to devote time to fixing it for this specific input

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/daattali/colourpicker/issues/8#issuecomment-283483337, or mute the thread https://github.com/notifications/unsubscribe-auth/AEkATgrkIcqx0pnRLpsbxgc6I41Nr9C-ks5rhelLgaJpZM4MQO1j.