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

DropDownTree #76

Open
msgoussi opened this issue May 13, 2019 · 5 comments
Open

DropDownTree #76

msgoussi opened this issue May 13, 2019 · 5 comments

Comments

@msgoussi
Copy link

I am wondering if we can create a dropdown tree (TRISTATE) as it is shown in the website
https://demos.telerik.com/aspnet-ajax/dropdowntree/examples/functionality/checkboxes/defaultcs.aspx

since I do not have a enough space for shiny tree (which contains 100 elements).
ie World contains 6 continents, each continent has countries.

@emtl97
Copy link

emtl97 commented May 13, 2019 via email

@trafficonese
Copy link
Contributor

trafficonese commented May 13, 2019

What if you combine shinyTree with shinyWidgets and include the tree in a dropdownButton?
Would that solve your issue?

Here's a small example:

library(shiny)
library(shinyTree)
library(shinyWidgets)

ui <- fluidPage(
  dropdownButton(circle = FALSE, label = "Show Tree",
    shinyTree("tree", stripes = TRUE, checkbox = TRUE)
  )
)

server <- function(input, output, session) {
  output$tree <- renderTree({
    list(
      root1 = "",
      root2 = list(
        SubListA = list(leaf1 = "", leaf2 = "", leaf3=""),
        SubListB = list(leafA = "", leafB = "")
      ),
      root3 = list(
        SubListA = list(leaf1 = "", leaf2 = "", leaf3=""),
        SubListB = list(leafA = "", leafB = "")
      )
    )
  })
}
shinyApp(ui, server)

@msgoussi
Copy link
Author

Thanks for replying but I get an error when I run the code:
Error in shinyTree("tree", stripes = TRUE, checkbox = TRUE) :
unused argument (stripes = TRUE)

@YsoSirius
Copy link
Contributor

Just delete the stripes argument as it's not necessary for that example.
It uses the github version and not the current CRAN version.

@trafficonese
Copy link
Contributor

@msgoussi Is you're problem solved with that example?

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

No branches or pull requests

4 participants