Code Monkey home page Code Monkey logo

Comments (3)

stla avatar stla commented on June 10, 2024 1

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 /(^shiny|^jstree(r|-|$))/ in jstreegrid.js, to prevent the classes shiny-bound-output and jstreer to be copied, and the problem has gone.

from shiny.

gadenbuie avatar gadenbuie commented on June 10, 2024

What's interesting is that I see two .shiny-bound-output objects -- or even two htmlwidgets in this example:

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 does have the correct binding; it's the .jstree-grid-wrapper that's throwing the error:

$("#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?

from shiny.

ismirsehregal avatar ismirsehregal commented on June 10, 2024

@gadenbuie thanks for the hints!

To me the jstree initialization code looks just like the boilerplate.

The class shiny-bound-output seems to be added here, however, so far I don't understand how or where the jstree-grid-wrapper element is enlisted or chosen for binding. I'll keep digging.

from shiny.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.