将鼠标光标更改为R Shiny中的手(指针)

编程入门 行业动态 更新时间:2024-10-19 20:43:09
本文介绍了将鼠标光标更改为R Shiny中的手(指针)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当用户将鼠标悬停在数据表单元格上时如何将鼠标悬停图标更改为指针(手)。我在数据表中有4列,第4列行单元格上显示着工具提示鼠标移到。我需要在显示工具提示时将光标图标更改为指针。我认为可以通过dt软件包选项& JS,但到目前为止没有成功,任何在 R Shiny UI 中实现相同效果的技巧。

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 on mouse over. I need to change the cursor icon to pointer when tool tip is displayed.I think this can be achieved through dt package options & JS but no success till now,Any Tips to achieve the same in R Shiny UI.

推荐答案

结合使用 CSS脚本和DT Package的rowCallback功能来实现此功能。这是虹膜数据表的代码:

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 "}") ) ) }) } )

更多推荐

将鼠标光标更改为R Shiny中的手(指针)

本文发布于:2023-07-19 08:49:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1154873.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:鼠标   光标   指针   Shiny

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!