-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Error in init.ts when using library(jsTreeR) #3981
Comments
What's interesting is that I see two document.querySelectorAll(".shiny-bound-output")
// NodeList(2) [...]
document.querySelectorAll(".shiny-bound-output").forEach(el => console.log(`${el.tagName}${el.id ? "#" : ""}${el.id}.${[...el.classList].join('.')}`))
// DIV.jstree-grid-wrapper.jstreer.html-widget.html-widget-output.shiny-report-size.html-fill-item.shiny-bound-output
// DIV#jstree.jstreer.html-widget.html-widget-output.shiny-report-size.html-fill-item.shiny-bound-output.jstree.jstree-1.jstree-grid-cell.jstree-default The element with $("#jstree").data("shiny-output-binding")
// OutputBindingAdapter2 {el: div#jstree.jstreer.html-widget.html-widget-output.shiny-report-size.html-fill-item.shiny-bound-outp…, binding: OutputBinding2, onResize: ƒ}
$(".jstree-grid-wrapper").data("shiny-output-binding")
// undefined My first instinct is to look into the jstree initialization code. Maybe you're cloning or re-using an initial element and retaining some classes on the copy that aren't needed? |
@gadenbuie thanks for the hints! To me the jstree initialization code looks just like the boilerplate. The class |
I've found the reason @gadenbuie - see https://stackoverflow.com/a/77993889/1100107. That's the jsTreeGrid plugin which copies the classes of the tree to the grid. So I changed the regex to |
I've already raised the issue here, however, I'm not sure if in this case
shiny
orjsTreeR
needs to make a move.When running the following app using the latest CRAN version of
library(jsTreeR)
(2.5.0) after resizing the browser window this error can be seen in the browser console:Example app:
This is only the case when
jstree
is provided with the grid parameter (table wrapped around the tree).@stla identified that the class
shiny-bound-output
is assigned to thejstree-grid-wrapper
div which causes the issue and that removing it prevents the issue.I'm wondering whether removing the class only is "combating symptoms" and if this should be addressed in shiny (similar to this).
The text was updated successfully, but these errors were encountered: