Skip to content

Feature request: Adding DT datatable to slickR carousel in shiny #79

@sactyr

Description

@sactyr

Hi there, thank you for providing this awesome package. I have a feature request, which is to expand slickR's ability to showcase objects beyond images and pdfs, starting with DT datatables in a shiny app.

In the example below, I would like to show the selected iris image and it's corresponding table. There are 3 images, one for each iris species, in the www folder.

library(shiny)
library(dplyr)
library(purrr)
library(DT)
library(slickR)

ui <- fluidPage(
  slickROutput("iris_slickr")
)

server <- function(input, output) {
  
  output$iris_slickr <- renderSlickR({
    
    iris_split <- iris %>% 
      split(f = ~Species) 
    
    iris_names <- names(iris_split)
    
    iris_images <- paste0(iris_names, ".jpg") %>% 
      map(~htmltools::tags$img(src = .x)) %>% 
      set_names(iris_names)
    
    slickR(
      map(
        iris_names
        ,~slick_list(
          iris_images[[.x]],
          datatable(iris_split[[.x]])
        )
      )
    )
    
  })
  
}

shinyApp(ui = ui, server = server)

As expected only the images show up, and not the DT datatable. I believe this is because datatable will require its own renderDT function. I posted on SO, and Stefan suggested the iframe method to show the datatable, but I am hoping for a solution that doesn't use an iframe and without having to save and load files. Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions