1.0.3 version failed to render Tree in Shiny
dylancis opened this issue · comments
Hi there- the 1.0.1 version from CRAN AND from GitHub of jsTree works fine with the example from the repo (pasted below):
library(jsTree)
ui <- shiny::fluidPage(
shiny::column(width=4,jsTree::jsTreeOutput('tree')),
shiny::column(width=8,shiny::uiOutput('chosen'))
)
server <- function(input, output,session) {
network <- shiny::reactiveValues()
shiny::observeEvent(input$tree_update,{
current_selection <- input$tree_update$.current_tree
if(!is.null(current_selection))
network$tree <- jsonlite::fromJSON(current_selection)
})
shiny::observeEvent(network$tree,{
output$results <- shiny::renderPrint({
str.out <- ''
if(length(network$tree)>0)
str.out=network$tree
return(str.out)
})
})
output$chosen <- shiny::renderUI({
list(shiny::h3('Selected Items'),
shiny::verbatimTextOutput(outputId = "results"))
})
output$tree <- jsTree::renderJsTree({
nested_string <- apply(states,1,paste,collapse='/')
jsTree(nested_string,browse = FALSE)
})
}
shinyApp(ui, server)
But it does lack of some further support fore more arguments such as 'core' newly introduced. However the 1.0.3 version installed from GitHub failed to render. The Rstudio show the HTML widget in viewer but not in the we app itself.
The error I have in the shiny app is:
Listening on http://127.0.0.1:5618
Warning: Error in : $ operator is invalid for atomic vectors
78: origRenderFunc
77: output$tree
1: runApp
SessionInfo is:
sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server >= 2012 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] jsTree_1.0.3 shiny_1.0.5.9000
loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 crayon_1.3.4 digest_0.6.15 later_0.7.1.9000 mime_0.5 R6_2.2.2 xtable_1.8-2 jsonlite_1.5
[9] magrittr_1.5 rlang_0.2.0 rstudioapi_0.7 data.table_1.11.0 promises_1.0.1 tools_3.4.4 htmlwidgets_1.2 httpuv_1.4.1.9000
[17] yaml_2.1.18 compiler_3.4.4 htmltools_0.3.6
sorry. i didnt check the app in my tests. until i add it there this commit should fix it 01ddf21
thanks.