Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 呈现rhandsontable后,日期选择器显示在模式对话框后面_Jquery_R_Shiny_Modal Dialog_Handsontable - Fatal编程技术网

Jquery 呈现rhandsontable后,日期选择器显示在模式对话框后面

Jquery 呈现rhandsontable后,日期选择器显示在模式对话框后面,jquery,r,shiny,modal-dialog,handsontable,Jquery,R,Shiny,Modal Dialog,Handsontable,我在一个闪亮的应用程序中使用了handsontables和modal对话框,这两个应用程序似乎互不喜欢。更具体地说,一旦通过rhandsontableOutput生成了handsontable,使用jQuery的模态对话框中的输入行为就会异常。有关可复制的示例,请参见下文。您会注意到,在调用handsontable之前,一切正常,但一旦勾选了复选框,datepicker就会出现在模式对话框后面,之前也曾出现过类似的问题,但在handsontables的上下文中没有。请注意,我有意使用这种稍微奇怪

我在一个闪亮的应用程序中使用了handsontables和modal对话框,这两个应用程序似乎互不喜欢。更具体地说,一旦通过rhandsontableOutput生成了handsontable,使用jQuery的模态对话框中的输入行为就会异常。有关可复制的示例,请参见下文。您会注意到,在调用handsontable之前,一切正常,但一旦勾选了复选框,datepicker就会出现在模式对话框后面,之前也曾出现过类似的问题,但在handsontables的上下文中没有。请注意,我有意使用这种稍微奇怪的方式通过renderUI呈现handsontable,以确保只要不勾选复选框,模式就可以正常工作

我使用的是Shining的1.4.0.2版和rhandsontable的0.3.7版

谢谢你的建议

library(shiny)
library(rhandsontable)

ui <- fluidPage(
  helpText("Click this first. Date picker should work fine."),
  actionButton("show", "Show modal"),
  hr(),
  helpText("Now click below to render the handsontable. When showing the modal again, the date picker shows up behind the modal."),
  checkboxInput("showHot", "Show handsontable"),
  uiOutput("hot_rendered")
)

server <- function(input, output, session) {
  # Modal:
  observeEvent(input$show, {
    showModal(
      modalDialog(
        title = "My Modal",
        dateInput("date", "Choose date")
      )
    )
  })
  # Handsontable:
  output$hot_rendered = renderUI({
    req(input$showHot==T)
    rHandsontableOutput("hot")
  })
  output$hot = renderRHandsontable({
    req(input$showHot==T)
    rhandsontable(head(iris))
  })
}

shinyApp(ui, server)
我认为这是一个已知的问题,您可以自己调整z指数:

library(shiny)
library(rhandsontable)

ui <- fluidPage(
    tags$style(HTML(".datepicker {z-index:99999 !important;}")),

    helpText("Click this first. Date picker should work fine."),
    actionButton("show", "Show modal"),
    hr(),
    helpText("Now click below to render the handsontable. When showing the modal again, the date picker shows up behind the modal."),
    checkboxInput("showHot", "Show handsontable"),
    uiOutput("hot_rendered")
    )

server <- function(input, output, session) {
    # Modal:
    observeEvent(input$show, {
        showModal(
            modalDialog(
                title = "My Modal",
                dateInput("date", "Choose date")
            )
        )
    })
    # Handsontable:
    output$hot_rendered = renderUI({
        req(input$showHot==T)
        rHandsontableOutput("hot")
    })
    output$hot = renderRHandsontable({
        req(input$showHot==T)
        rhandsontable(head(iris))
    })
}

shinyApp(ui, server)