0

I am working in a shiny app.

If a paragraph (a long paragraph) is inside the wellPanel, the paragraph is split into multiple lines to adjust to the wellPanel's width without any problem. But when I put it inside a splitLayout(), the paragraph is rendered in just one line (and I need to scroll to see the remaining parts)...

How can I tie the paragraphs' width to the wellpanel's width inside a splitLayout?

Follows a minimal reproducible example

---
title: "Example"
runtime: shiny
output: 
  flexdashboard::flex_dashboard:
    orientation: column
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
library(shiny)
library(dplyr)
library(DT)

knitr::opts_chunk$set(echo = TRUE)

```

```{r,echo=FALSE}
   splitLayout(cellWidths=c("30%","70%"),
    wellPanel(selectInput("Indicator","select",choices=c(),selected="NONE"),
      p("This is my first sentence in the paragraph. This is my second sentence in the paragraph. This is another sentence within the paragraph.")),
    wellPanel(
    dataTableOutput("OrigData")
   )
  )

observe({
  Inds<-as.factor(mtcars[,2])%>%levels
  updateSelectInput(session,inputId="Indicator",choices=Inds)
})

output$OrigData<-DT::renderDataTable(mtcars)

```

and a picture of how it is shown

Screen

Thanks in advance,

hamagust
  • 728
  • 2
  • 10
  • 28
  • it is easier to help when you provide a full [reproducible minimal example](https://stackoverflow.com/q/5963269/8107362). In case of shiny apps, this means a very basic but working app.R script. – mnist Jan 14 '20 at 17:07
  • Hi, @mnist. Thank you for looking at the question. It is a code for flexdashboard. So, it is almost all the code (just without library and layout specifications)... but, just in the case, I am changing and including the initial part... – hamagust Jan 14 '20 at 17:21

1 Answers1

0

I am sharing how I solved this issue...

I replaced the splitLayout by column-based structure.

---
title: "Example"
runtime: shiny
output: 
  flexdashboard::flex_dashboard:
    orientation: column
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
library(shiny)
library(dplyr)
library(DT)

knitr::opts_chunk$set(echo = TRUE)

```

```{r,echo=FALSE}
column(3,offset=0,
  selectInput("Indicator","select",choices=c(),selected="NONE"),
      p("This is my first sentence in the paragraph. This is my second sentence in the paragraph. This is another sentence within the paragraph.")

)
column(9,
     dataTableOutput("OrigData")
  )

observe({
  Inds<-as.factor(mtcars[,2])%>%levels
  updateSelectInput(session,inputId="Indicator",choices=Inds)
})

output$OrigData<-DT::renderDataTable(mtcars)

```

I have been using splitLayout for a long. But I migrated to flexdashboard more recently, so, maybe what is happening is not all shiny elements are compatible with all shiny app types... (splitLayout and flexdashboard in this case)...

hamagust
  • 728
  • 2
  • 10
  • 28