Is it possible to use Javascript with Shiny to expand and collapse individual wellPanels in the sidebar upon a button click? I have tried various manifestations of mixing some canned javascript with shiny apps but no luck yet.
For example, things like:
sidebarPanel(
tags$head(
....
),
HTML("<button>Expand/Collapse</button>"),
div(id='wpDiv1',class='wpDiv',
wellPanel(...
#### various input controls
...)
),...
and somewhere, but I don't know where, something like:
<script>
$("button").click(function () {
$("wpDiv").slideToggle("slow");
});
</script>
which I'll call button1.html and for the time being I have included in the sidebarPanel call as includeHTML("www/html/button1.html")
Of course, none of this works, except for the simple HTML("<button>Expand/Collapse</button>") call which does make a non-functional button. I am guessing the tags$script thing is not right. I have tried various combination of tags, div, HTML, includeHTML. I have tried the shinyIncubator actionButton instead of the generic button. I have tried different placements in the ui.R script. But I don't actually even know if this is something that is possible to do in the first place. I would like a wellPanel that begins short, only revealing say, a button, which can be clicked to expand the wellPanel to show a larger vertical list of inputs (and shrink back as well). Can this be done?
Thanks,
Matt