Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

R: Shiny.OnInputChange live click

$
0
0

Say I have an object in the browser DOM with class=“row” and id=“row22”.

I want to use Shiny.onInputChange() to detect a click on that object and send the id to a Shiny input$ variable. I’ve worn out Google looking for an example of how to do this but haven’t come up with anything. Could someone who knows how to do this provide some sample code? it should work something like $(document).on in jquery

For example:

In Javascript, added a function that looks like this:

function my_row(n) {
  Shiny.onInputChange("js.row", n);
};

In Shiny code added an observer that looks for changes on input$js.row :

 observeEvent(input$js.row, {
    print(paste0("Value of js.row is ", input$js.row))
 })

still Shiny.OnInputChange not triggering observeEvent(input$js.row! Do we have alternative approach?


Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>