Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

valueBox class not always being cleared #106

Closed
davidski opened this issue Jan 27, 2017 · 1 comment
Closed

valueBox class not always being cleared #106

davidski opened this issue Jan 27, 2017 · 1 comment

Comments

@davidski
Copy link

@davidski davidski commented Jan 27, 2017

When setting the color attribute based upon the value of the input to valueBox when using the Shiny runtime, the valuebox div does not always have the previous class removed and winds up with two bg-* classes applied (and the wrong value taking precedence).

To reproduce:

  1. Run the following example (or check out the live running version on Shinnyapps)
  2. Choose danger and see the color change as expected
  3. Choose success and see the color change as expected
  4. Choose danger again and see the color not change. Inspecting the HTML shows two classes now applied.

Example code as follows:

---
title: "Shiny testbed"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
runtime: shiny
---

```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)

Column {data-width=650}

Chart A

data(mtcars)
ggplot(mtcars, aes(mpg, cyl)) + geom_point()

Column {data-width=350}

Input Selection

class_color <- c("warning", "danger", "success")
selectInput("input_value", "Choose Color", class_color)

Datatable

options(DT.fillContainer = FALSE)
options(DT.autoHideNavigation = FALSE)
DT::renderDataTable({
 dat <- mtcars
 DT::datatable(dat, options = list(
    scrollY = "200px"
  ))
})

Valuebox

renderValueBox({
  dat <- input$input_value
  valueBox(dat,
           caption = "Testing colors", icon = "fa-pencil", 
           color = dat)
})
@jjallaire
Copy link
Member

@jjallaire jjallaire commented Jan 27, 2017

I've seen this bug before but had hard time reproing it -- this drove me crazy! Thanks so much, I'll see if I can get it fixed based on your example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.