2

I have a website with a DataTable. Following this I create a js event on clicking on a row. The event stores an id corresponding to the clicked row in a variable and following this I posted a message to the shiny-iframe.

$(document).ready(function() {
    var table = $('#example').DataTable( {
"columnDefs": [
            {
                "targets": [ 0 ],
                "visible": false,
                "searchable": false
            }
            ]
});
    $('#example tbody').on('click', 'tr', function () {
        var data  = table.row( this ).data();
        var table_row_id = data[0];
        var frame = document.getElementById('shiny-iframe');
        frame.contentWindow.postMessage(table_row_id, '*');
    } );
} );

Still I am not sure how to proceed from here. The end result is to have shiny reloading the app in the iframe with as argument the variable stored in table_row_id.

Community
  • 1
  • 1
CptNemo
  • 5,805
  • 14
  • 46
  • 95
  • Here is the way to pass JS variables to Shiny https://ryouready.wordpress.com/2013/11/20/sending-data-from-client-to-server-and-back-using-shiny/ – Xiongbing Jin Apr 18 '16 at 15:23

0 Answers0