Can checkboxgroupinputs appear in few columns?

3,289 views
Skip to first unread message

Adomas Budrys

unread,
Feb 14, 2014, 6:07:52 AM2/14/14
to shiny-...@googlegroups.com
Hi,

I have a lot of variables (~500) which list is rendered using checkboxgroupinput(), however, all of them renders in one column. Like this:


I would like to ask, if it's possible to make them appear in whole screen? I would like thee 500 elements to be separated, for example, to 5 columns, therefore each column with 100 variables. Like this: 





I am using fluidPage() and suggesting pseudocode which I am trying right now. But that gives the same ouput. I will have a plot above all check boxes.

output$tab <- renderUI({
    fluidPage(title = "Big checkbox",
      plotOutput("plot")
      fluidRow(column(12,h2("Testing"),
                      checkboxGroupInput("testing","Big table",choices=c(1:500))))
      
      )
  })

I understand that I could separate these 500 elements to few groups and then render them using fluidRow, but is there another way to do that?

Thanks in advance!

Andrew Caines

unread,
Feb 20, 2015, 3:24:10 PM2/20/15
to shiny-...@googlegroups.com
I know this post is a year old, but it wasn't answered, and now I have the same question.. does anyone know how to make columns from the checkboxGroupInput() 'choices'?

I'm aware of the 'inline' Boolean but this is not quite what I and, I think, Adomas would like (unless you solved it already, Adomas?)

Andrew

Andrew Caines

unread,
Feb 25, 2015, 4:24:41 PM2/25/15
to shiny-...@googlegroups.com
Btw, the solution comes via CSS3 'column-count': http://www.w3schools.com/css/css3_multiple_columns.asp

And custom CSS in Shiny (I chose the method: 'add to header' of UI with 'tags') http://shiny.rstudio.com/articles/css.html

i.e.


## here's the top of your ui.R file

shinyUI(fluidPage(

 ## custom CSS for 3 column layout (used below for mechanics filter options)
  tags$head
(
    tags$style(HTML("

     .multicol {

       -webkit-column-count: 3; /* Chrome, Safari, Opera */

       -moz-column-count: 3; /* Firefox */

       column-count: 3;

     }

   "))

 ),

## use the css, assuming your long list of vars comes from global.R

   wellPanel(

     tags$div(class = "multicol", checkboxGroupInput("foo", choices = your_vars, label = "foo", selected = NULL))

   )

))



Dmitriy Selivanov

unread,
Dec 16, 2015, 12:53:24 PM12/16/15
to Shiny - Web Framework for R
Also  there is  "inline" option, which can help if you have a lot of choices.



четверг, 26 февраля 2015 г., 0:24:41 UTC+3 пользователь Andrew Caines написал:
Reply all
Reply to author
Forward
0 new messages