Skip to content Skip to sidebar Skip to footer

Change Mouse Cursor To Hand (pointer) In R Shiny

How I can change the mouse over icon to pointer (hand) when user hover over data table cells.I am having 4 columns in a datatable and the 4th column row cells is diplaying tool tip

Solution 1:

Used CSS Script with rowCallback feature of DT Package to achieve this.Here is the code for iris datatable :

library(shiny)
library(DT)

shinyApp(
ui = fluidPage(
DT::dataTableOutput("irisTable")
),
server = function(input, output) {

output$irisTable <- DT::renderDataTable({
  DT::datatable(datasets::iris, 
                options = list(rowCallback = JS(
                  "function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {",
                  "var full_text = aData[1] + ','+ aData[2] + ',' + aData[3] + ','+ aData[4];",
                  "$('td:eq(5)', nRow).attr('title', full_text);", # Tool Tip
                  "$('td:eq(5)', nRow).css('cursor', 'pointer');", # Cursor icon changes to hand (pointer) on Hover
                  "}")
                )
  )

})
}
)

Post a Comment for "Change Mouse Cursor To Hand (pointer) In R Shiny"