Tag: shiny

Rshiny鼠标hover到所有表格单元格

如何实现所有表格单元格的鼠标hover文本(不是列名称)。我有3列的数据表。 在鼠标hover在第3列的单元格上时,需要显示该特定行的第1列和第2列的组合内容。我尝试探索DT包以实现相同但没有成功。任何提示或我们是否有任何支持hover的库表。

Shiny.onInputChange不是一个函数

我有像我的shiny应用程序中的代码: $(function() { Shiny.onInputChange(‘initialHash’, parseHashQuery()); }); function parseHashQuery() { var result = {}; location.hash.replace(/^#/, ”).split(‘&’).filter(Boolean).forEach(function(part) { var pair = part.split(‘=’); result[pair[0]] = pair[1]; }); return result; } 但我有错误: common.js:59 Uncaught TypeError: Shiny.onInputChange is not a function at HTMLDocument. (common.js:59) at i (jquery.min.js:2) at Object.fireWith [as resolveWith] (jquery.min.js:2) at Function.ready (jquery.min.js:2) at HTMLDocument.K (jquery.min.js:2)

在shiny的应用中捕获iframe中的点击

我希望在shiny的应用中捕获iframe中的链接。 我想知道点击了哪个链接。 外面有光泽,这很好用。 我为相关问题添加了一个完全可重现的示例: https : xaamp (它必须在(本地)服务器上运行,例如xaamp )。 我的尝试: 1)要保存在Path/To/App 。 2)在www文件夹中存储应该在iframe中显示的html文件。 fileWithLink.html SOreadytohelp 3)必须使用runApp(“Path/To/App”, launch.browser = TRUE)启动应用程序runApp(“Path/To/App”, launch.browser = TRUE) (以便启动本地服务器)。 library(shiny) library(shinyjs) ui <- fluidPage( useShinyjs(), htmlOutput("filecontainer") ) server <- function(input, output, session){ session$onFlushed(once = T, function(){ runjs(" console.log('I arrive here') $('#filecontainer').load(function(){ console.log('But not here') var iframe = $('#filecontainer').contents(); iframe.find('#a').click(function(){ alert('I want […]

R shiny – 在selectInput中保存选定的值

我有10个’编辑’动作按钮。 在每个“编辑”操作按钮上会出现三个selectInput。 点击selectInputs下方的“保存”按钮后,我想记住所选的值。 如果我转到第2行 – >单击“编辑” – >选择值 – >单击“保存”并返回第1行,它不记得先前在第1行中选择的值。 所以我想在“保存”按钮上有两个动作,即: 存储给定’行’的选定值(所以当我再次点击相同的编辑按钮时,我将看到之前选择的值) 单击“保存”按钮后,使所有selectInputs消失 库(shiny) ui <- shinyUI(fluidPage( titlePanel("Update Select Inputs"), mainPanel( tags$head(tags$script(HTML("$(document).on('click', '.needed', function () { Shiny.onInputChange('last_btn',this.id); });"))), column(width = 6, uiOutput('ValuesAndButtons')), column(width = 6,uiOutput('Details')) ) ) ) server <- shinyServer(function(input, output) { output$ValuesAndButtons <- renderUI({ lapply( c(1:10), function(i){ fluidRow( column( width = 4, tags$span(i) […]

如何在高亮度列rshiny情节中了解有关单击条的信息

我想在用户点击列高清图的栏中时检测到一些信息。 如果在图例中选择了名称或者单击了背景,我需要知道所单击栏的名称和类别。 名称部分没问题,但我无法发现哪些是我必须编写的JS代码才能知道这类信息。 非常感谢 library(“shiny”) library(“highcharter”) ui <- shinyUI( fluidPage( column(width = 8, highchartOutput("hcontainer", height = "500px")), column(width = 4, textOutput("text")) ) ) server <- function(input, output) { a <- data.frame(b = LETTERS[1:10], c = 11:20, d = 21:30, e = 31:40) output$hcontainer <- renderHighchart({ myClickFunc % hc_xAxis(categories = a$b) %>% hc_add_serie(name = “c”, data […]

在RStudioshiny,希望自定义一个表

在一个带有由renderTable()生成的表的RStudioshiny应用程序中,我想添加一个前导列的单选按钮(当然是被动的)并更改所选行的样式。 什么是最好的策略? 我想如果绝对必要的话我可以使用jQuery,但是不是更简单的方法吗? 我已经尝试将html插入到renderTable()表达式中的表格单元格args …不起作用。

Rshiny的DataTables ColVis行为

我有一个带有DataTables的RStudio Shiny服务器页面,我在下面的示例中使用了TableTools和ColReorder,但是ColVis( Show/hide columns按钮)的行为方式与http://datatables.net/中的示例不同extensions / colvis / : 单击“ Show/hide columns按钮时,列表会与下面表格中的值混淆,并且无法通过再次单击按钮或单击页面中的任何其他位置使列表消失(同样,数据表页面中的示例表现为正确)。 另外,我对使用sDom命令表中的不同元素感到困惑。 我希望Show/hide columns按钮位于右上角而不是左上角。 我也不确定如何在表的sDom中订购不同的元素,以便在更改列的顺序后,保存到CSV / Excel或隐藏某些列将为我提供新的表格布局而不是原始的布局。 有任何想法吗? ui.R shinyUI(pageWithSidebar( h1(‘Diamonds DataTable with TableTools’), tagList( singleton(tags$head(tags$script(src=’//cdnjs.cloudflare.com/ajax/libs/datatables/1.9.4/jquery.dataTables.min.js’,type=’text/javascript’))), singleton(tags$head(tags$script(src=’//cdnjs.cloudflare.com/ajax/libs/datatables-tabletools/2.1.5/js/TableTools.min.js’,type=’text/javascript’))), singleton(tags$head(tags$script(src=’//cdn.datatables.net/colreorder/1.1.1/js/dataTables.colReorder.min.js’,type=’text/javascript’))), singleton(tags$head(tags$script(src=’//cdn.datatables.net/colvis/1.1.0/js/dataTables.colVis.min.js’,type=’text/javascript’))), singleton(tags$head(tags$script(src=’//cdnjs.cloudflare.com/ajax/libs/datatables-tabletools/2.1.5/js/ZeroClipboard.min.js’,type=’text/javascript’))), singleton(tags$head(tags$link(href=’//cdnjs.cloudflare.com/ajax/libs/datatables-tabletools/2.1.5/css/TableTools.min.css’,rel=’stylesheet’,type=’text/css’))), singleton(tags$script(HTML(“if (window.innerHeight < 400) alert('Screen too small');"))) ), dataTableOutput("mytable") ) ) server.R shinyServer(function(input, output, session) { output$mytable = renderDataTable({ diamonds[,1:6] }, options = list( […]

R Shiny:renderUI中的表条件格式

在另一篇文章中 ,假设该表不是renderUI函数的一部分,则回答了同样的问题。 在下面的例子中,我试图调整相同的解决方案(使用JQuery),其中我想条件格式化的表属于renderUI函数。 library(shiny) library(datasets) script 50) { $(this).css(‘background-color’, ‘#0c0’); } else if (cellValue <= 50) { $(this).css('background-color', '#f00'); } })" shinyServer(function(input, output, session) { session$onFlushed(function() { session$sendCustomMessage(type='jsCode', list(value = script)) }) output$view <- renderTable({ head(rock, n = 20) }) output$Test1 <- renderUI({ list( tags$head(tags$script(HTML('Shiny.addCustomMessageHandler("jsCode", function(message) { eval(message.value); });'))), tableOutput("view") ) }) }) shinyUI(fluidPage( tabsetPanel( […]

自定义shiny的selectInput中的下拉宽度

从这个问题中采用的下面的代码可以防止包装文本的下拉,并设置所有下拉列表的宽度。 有没有办法为每个selectInput自定义下拉列表的宽度? library(shiny) ui <- (fluidPage( sidebarLayout( sidebarPanel( selectInput("userInput","Select User", c(1,2,3), selected=1), selectInput("LongInput", "Long Strings", c("This is a long long string that is long.", "This is a long long string that is longer.")) ), # allows for long texts to not be wrapped, and sets width of drop-down tags$head( tags$style(HTML(' .selectize-input { white-space: nowrap; } […]