shinyhelper icon indicating copy to clipboard operation
shinyhelper copied to clipboard

shinyhelper not working in modules and shinybulma ?

Open bcaessens opened this issue 3 years ago • 5 comments

Hi,

Thanks for this package, it really seems to fit what I need for my application.

I have a modularized app using shinybulma for styling. The call to observe_helpers is in the main app.R server part. The helpers are called in the module in dynamic outputs as in the examples.

I get the helper icon, and on inspect, all the information for rendering is there. However, clicking the icon causes a javascript error in the console:

Uncaught TypeError: $(...).modal is not a function
    at <anonymous>:1:19
    at b (jquery.min.js:2)
    at Pe (jquery.min.js:2)
    at S.fn.init.append (jquery.min.js:2)
    at S.fn.init.<anonymous> (jquery.min.js:2)
    at $ (jquery.min.js:2)
    at S.fn.init.html (jquery.min.js:2)
    at Object.renderHtml (output_binding_html.js:230)
    at Object.exports.renderHtml (output_binding_html.js:69)
    at Object.exports.renderContent (output_binding_html.js:46)

Any thoughts as to what could be causing this. Kind regards, Bernie.

bcaessens avatar Jun 08 '21 07:06 bcaessens

Browsing through the issues, I think this one is similar to #19.

bcaessens avatar Jun 08 '21 07:06 bcaessens

To be honest not 100% sure on this - the error message is in the JS for shinybulma, which I've not come across before. This and #19 are both because the underlying mechanism for creating and showing a modal is different to the 'standard' (bootstrap) in those packages.

Do you have a reprex you can share?

cwthom avatar Jun 18 '21 07:06 cwthom

Hi,

Not straight away no (I would need to disentangle some sensitive information). But I'll see what I can do. I did fork the shinyhelper code, and I added 'theme' as an extra option, changing the call code to be what shinybulma expects for modals! The good news: works like a charm! The bad news, then I lost all mathjax :-/ so for now, due to deadlines, I put this on hold and solved it with plain old HTML.........sigh. I will see if I can set something basic up later today.

Bernie.

bcaessens avatar Jun 18 '21 07:06 bcaessens

Ah great! Well PRs very gratefully received - would have to have a look at how shiny supports mathjax and whether that's easy to replicate.

cwthom avatar Jun 18 '21 08:06 cwthom

Hi, has a solution been found?

I'm trying to add an inline helper to a fileInput within a module (no shinybulma involvement) and the icon is there but the modalDialog doesn't appear. No error, nor any messages in the console, just no modal dialog.

I have added observe_helpers() in my server code, and have also tried observe_helpers(session = session).

CarlijnB avatar Aug 29 '23 11:08 CarlijnB