Search code examples
shinyshiny-server

Why some button displayed strangely in Shiny?


My second button display strangely sometimes. Anyone encountered the same situation? any solutions?

enter image description here

The second button is a download function, coding as following:

 downloadButton('downloadData', 'Export Keywords'),

I'm using the following style:

tags$head(
        tags$link(rel = "stylesheet", type = "text/css", href = "bootstrap.css")
#tags$style(HTML('#run{background-color:orange}'))
),

I tried to specify the width and height under css file of the button class. After that, it shows: enter image description here

I think the root of the problem is that the lable for the button is missing at run time. When comparing the html code, I found:

  <button class="btn btn-default action-button btn-success 
    shiny-bound-input" id="runButton" type="button">Run Analysis! 
  </button>

   <a id="downloadData" class="btn btn-default shiny-download-link 
     btn-success shiny-bound-output"
     href="downloadData?w=" target="_blank"></a>

Solution

  • The problem is resolved after I remove following function from downloadHandler()

    shiny::validate()