shinyglide
shinyglide copied to clipboard
How to not show loading spinner?
Hi again,
How can I prevent showing the loading spinner when using screenOutput?
I tried to use the standard class for the next button but this causes some strange behaviour. The next button changes class after a couple of seconds.
Thank you
Package version: 0.1.4 R verison 4.3.1
library(shiny)
library(shinyglide)
ui <- fluidPage(
glide(
loading_label = "Next ",
loading_class = "btn btn-primary next-screen",
screen(
p("Do you want to see the next screen ?"),
checkboxInput("check", "Yes, of course !", value = FALSE)
),
screenOutput("check_screen"),
screen(
p("And this is the last screen")
)
)
)
server <- function(input, output, session) {
output$check_screen <- renderUI({
Sys.sleep(2)
if(!input$check) return(NULL)
screen(
p("Here it is !")
)
})
outputOptions(output, "check_screen", suspendWhenHidden = FALSE)
}
shinyApp(ui, server)
Hi,
Maybe I don't understand what you're trying to achieve, but in your example if you don't define the loading_class
argument I think the loading spinner is not shown ?
Hi, I don't want the button to change at all when the checkboxInput becomes true. In my application when the loading spinner is shown the whole page moves to allow space for it.
If you don't apply a loading_class
or loading_label
the loading spinner is shown by default.
I managed to prevent the spinner by adding a loading_label
(see example below) but the format of the next button still changes- it becomes a pale blue and then back to darker blue after the 2 second delay. It seems something in the javascript still happens when the checkboxInput becomes true.
library(shiny)
library(shinyglide)
ui <- fluidPage(
glide(
loading_label = paste("Next", shiny::icon("chevron-right", lib = "glyphicon")),
# loading_class = "btn btn-primary next-screen",
screen(
p("Do you want to see the next screen ?"),
checkboxInput("check", "Yes, of course !", value = FALSE)
),
screenOutput("check_screen"),
screen(
p("And this is the last screen")
)
)
)
server <- function(input, output, session) {
output$check_screen <- renderUI({
Sys.sleep(2)
if (!input$check) return(NULL)
screen(
p("Here it is !")
)
})
outputOptions(output, "check_screen", suspendWhenHidden = FALSE)
}
shinyApp(ui, server)
I think the pale blue / dark blue transition is not directly due to shinyglide but to shiny, It is the same visual effect as for any output update. If you want to disable it I think you would have to tweak the CSS for this element.