yonicd / jsTree

R htmlwidget for inspecting heirachal structures with the ‘jQuery’ ‘jsTree’ Plugin.
https://yonicd.github.io/jsTree/
Other
30 stars 7 forks source link

How do I disable Multi selection in jsTree Package in R Shiny #1

Closed nidhinchandrasekhar closed 6 years ago

nidhinchandrasekhar commented 6 years ago

I am using jsTree in an R Shiny code for Hierarchical dropdowns and I need to disable the multi select option(Multi select is a default option in jsTree).

Please find the sample code snippet that I am using for this.

Region<-c("South","South","South","South","North","North","West","East","West","East")
State<-c("State1","State2","State2","State2","State3","State4","State5","State6","State7","State8")
City<-c("City1","City2","City3","City4","City5","City6","City7","City8","City9","City10")
superfundsite1=data.frame(Region,State,City)
myx10 <- apply(superfundsite1,1,function(x) paste(x,collapse = '/'))
jsTree(myx10)
yonicd commented 6 years ago

a new parameter for passing additional settings to the tree core object has been added.

you can install the new dev version of jsTree

remotes::install_github('metrumresearchgroup/jsTree')

and then run

jsTree(myx10,core=list(multiple=FALSE))

Thank you for bringing this to my attention.