I want to expand a cell in a DataTable in R Shiny when it is clicked on. I've come across the following implementation, where a user can hover over a cell to see the full contents of it:
DT::datatable(
bgcDF,
class = "display nowrap",
rownames = FALSE,
escape = FALSE,
options = list(
columnDefs = list(list(
targets = c(4),
render = JS(
"function(data, type, row, meta) {",
"return type === 'display' && data.length > 60 ?",
"'<span title=\"' + data + '\">' + data.substr(0, 60) + '...</span>' : data;",
"}")
)),
This is the first half of what I need. If data within a cell meets this criterion and has been shortened, how can I implement a click functionality that expands the data within that cell?
Thanks