smartinsightsfromdata/rpivotTable

rpivotTable is not working together with shinyjqui

derekzoutendijk opened this issue · 0 comments

Hi,

I found the following issue: When having a rpivotTable within your shiny app, the selectable in my shiny app no longer observes an event.

Reproduction:

  1. Run the code below
  2. Click one of the boxes within startpageDiv
    Result: The observe does not print the selected div (NOK)
  3. Comment the rpivotTableOutput
  4. Run again code and click one of the boxes
    Result: Observe does print selected div (OK)
    Note: When running in the browser and I press f12, I do see that the elements change to selected (even in combination with the pivot table)

####### Example code

library(shiny)
library(shinydashboard)
library(shinyBS)
library(shinyjs)
library(shinyjqui)
library(shinyWidgets)
library(rpivotTable)
library(tidyverse)

server <- function(input, output) {
observeEvent(input$startPageDiv_selected,
{
selected <- input$startPageDiv_selected %>% slice(1) %>% pull(text)
print(selected)

             output$PivotTest <- renderRpivotTable({
               rpivotTable(data.frame(test1 = c("a", "b", "c"), test2 = c(1,2,3)))
             })
           })

}

ui <- fluidPage(
fluidRow(
rpivotTableOutput('PivotTest')
),
fluidRow(
jqui_selectable(div(id="startPageDiv",
column(4,
div(id = "Ex1",
box(title = "Ex1", width="100%", height = "200px",
status = "danger",
solidHeader = TRUE,
h3("First")
))
),
column(4,
div(id = "Ex2",
box(title = "Ex2", width="100%", height = "200px",
status = "success",
solidHeader = TRUE,
h3("Second")
))
),
column(4,
div(id = "Ex3",
box(title = "Ex3", width="100%", height = "200px",
status = "info",
solidHeader = TRUE,
h3("Third")
))
)
))
)
)

shinyApp(ui, server)