Home > front end >  Vertically center selectInput in Shiny DT datatable when selectize javascript is applied
Vertically center selectInput in Shiny DT datatable when selectize javascript is applied

Time:11-30

I have a selectInput in a Shiny DT datatable. I needed to apply custom javascript to selectize the selectInput due to a formatting issue when using multiple = T (see other post: enter image description here

Here is a screenshot using the code above but commenting out the initComplete line, showing the selectInput improperly formatted but vertically centered: enter image description here

CodePudding user response:

Without the dummy selectize input, the selectize.js library is not included.

The CSS:

    tags$head(tags$style(
      HTML("td .form-group {margin-bottom: 0;} td .selectize-input {position: absolute; top: 50%; transform: translateY(-50%);} td .selectize-control {margin-bottom: 0;}")
    )),
  • Related