scrolling issue with insertUI and flexdashboard

110 views
Skip to first unread message

MySchizo Buddy

unread,
May 23, 2016, 2:03:15 PM5/23/16
to Shiny - Web Framework for R
Using insertUI to insert a module inside a single chuck doesn't add scrolling to the chunk container.
vertical-flow: scroll
is meant to scroll a page when multiple chucks are added to the page.

How can i add scrolling to the chuck itself?
starting code

---
title
: "Insert modules in flexdashboard"
output
:
  flexdashboard
::flex_dashboard
runtime
: shiny
---

```{r}

# include the worldPhones module
worldPhonesUI <- function(id) {
  ns <- NS(id)
  fillCol(height = 400, flex = c(NA, 1),
          inputPanel(
            selectInput(ns("region"), "Region:", choices = colnames(WorldPhones))
          ),
          plotOutput(ns("phonePlot"), height = "100%")
  )
}

# Server function
worldPhones <- function(input, output, session) {
  output$phonePlot <- renderPlot({
    barplot(WorldPhones[,input$region]*1000,
            ylab = "Number of Telephones", xlab = "Year")
  })
}
```


Sidebar {.sidebar}
------------------

Click the insert button below to add worldPhone module to the right. You can add as many modules as you want

```{r}
actionButton("insertModule", "Insert Module")

```


MainPage
-----------------

### World Phones modules {.no-title}

```{r}
h2("Module examples")

observeEvent(input$insertModule, {
  id = input$insertModule
  phoneid <- paste0("phones", id)
 
  callModule(worldPhones, phoneid)
  insertUI(selector = "h2",
           where = "afterEnd",
           ui = tagList(
             h4(paste0("Module number ", id)),
             worldPhonesUI(phoneid))
  )
})

```
.


Reply all
Reply to author
Forward
0 new messages