cytoscape / cyjShiny

An R/shiny widget for cytoscape.js
Other
92 stars 28 forks source link

Breaks datatable #13

Closed CosteaPaul closed 5 years ago

CosteaPaul commented 5 years ago

Trying to use cyjShiny and DT in the same app, but after adding cyjShiny, DT stops working. I get a js error saying DataTable is not a function.

This only happens if "cyjShinyOutput('cyjShiny')" is in the UI. Comment that out, and everything is fine! So....something going on with that div?

Since i imagine a lot of people who would like to use cyj use DT a lot, i'm filing this as an issue here... hope that's ok.

paul-shannon commented 5 years ago

@CosteaPaul - Thanks for the bug report. I was able to reproduce it.

Do you see this error message in your javascript console?

Uncaught TypeError: $table.DataTable is not a function
    at Object.renderValue (datatables.js:286)
    at exports.OutputBinding.shinyBinding.renderValue (htmlwidgets.js:516)
    at exports.OutputBinding.onValueChange (shiny.min.js:4)

That DataTable is not defined may be caused by cyjShiny having jQuery loaded twice: once in my package.json, once in Shiny. This stackoverflow post suggests as much.

I hope to figure this out quickly. I will keep you posted.

Thanks again for the bug report. (Please let me know if the error I see is also what you see.)

paul-shannon commented 5 years ago

@CosteaPaul - I think I have this fixed. Adding a call to jQuery.noConflict() at the top of cyjShiny.js seems to be all that is needed.

Committed in version 0.99.27 of the package, just now. Let me know if this solves your problem.
A sample shinyApp with cyjShiny and DT: inst/examples/withDT/app.R

Does this solve your problem?

CosteaPaul commented 5 years ago

Indeed, this is now fixed. Thanks!