I'm trying to write a callback function for a DT:datatable which does an updateTabItems in response to a double click on a row. The double click response looks like:
callback = JS('
table.on("dblclick.dt","tr", function() {
var data=table.row(this).data();
alert("You clicked on a row!");}
)
')
which works, but I don't really want an alert, I want the equivalent of updateTabItems(session,"id",newtab)
But the callback only accepts JavaScript. Anyone know how to do this in JavaScript?
thanks!
Hi @andrew57jm, not sure how to do this directly in JS, but you could add a line in your JS code that calls R and from there call the updateTabItems.
See also the documentation
Perfect. Works like a charm. Strange side effect however, When I include the double click callback and try and pipe the output of the DT::datatable to a formatStyle function, the table never displays any data. There must be some interaction between the two mechanisms. I'll leave that for another day as I can probably do my column formatting in the JavaScript callback.