R Shiny: Reactive Value in Modal not working2019 Community Moderator ElectionBind a function to Twitter Bootstrap Modal CloseDisallow Twitter Bootstrap modal window from closingBootstrap modal appearing under backgroundPrevent Bootstrap Modal from disappearing when clicking outside or pressing escape?Close Bootstrap ModalDisable click outside of bootstrap modal area to close modalAdd values to a reactive table in shinyR Shiny: reactiveValues vs reactiveShiny: dynamic dataframe construction; renderUI, observe, reactiveValuesR Shiny - Editing a data table inside a dynamically created bsModal
Light propagating through a sound wave
Violin - Can double stops be played when the strings are not next to each other?
Can other pieces capture a threatening piece and prevent a checkmate?
Knife as defense against stray dogs
Fewest number of steps to reach 200 using special calculator
Hausdorff dimension of the boundary of fibres of Lipschitz maps
Why is there so much iron?
Generic TVP tradeoffs?
What does "mu" mean as an interjection?
Can a wizard cast a spell during their first turn of combat if they initiated combat by releasing a readied spell?
Is there a term for accumulated dirt on the outside of your hands and feet?
Can you move over difficult terrain with only 5 feet of movement?
Does the attack bonus from a Masterwork weapon stack with the attack bonus from Masterwork ammunition?
How to generate binary array whose elements with values 1 are randomly drawn
Do native speakers use "ultima" and "proxima" frequently in spoken English?
Do I need to consider instance restrictions when showing a language is in P?
Do US professors/group leaders only get a salary, but no group budget?
Would it be believable to defy demographics in a story?
Existence of a celestial body big enough for early civilization to be thought of as a second moon
What exactly term 'companion plants' means?
Maths symbols and unicode-math input inside siunitx commands
Recruiter wants very extensive technical details about all of my previous work
Optimising a list searching algorithm
In what cases must I use 了 and in what cases not?
R Shiny: Reactive Value in Modal not working
2019 Community Moderator ElectionBind a function to Twitter Bootstrap Modal CloseDisallow Twitter Bootstrap modal window from closingBootstrap modal appearing under backgroundPrevent Bootstrap Modal from disappearing when clicking outside or pressing escape?Close Bootstrap ModalDisable click outside of bootstrap modal area to close modalAdd values to a reactive table in shinyR Shiny: reactiveValues vs reactiveShiny: dynamic dataframe construction; renderUI, observe, reactiveValuesR Shiny - Editing a data table inside a dynamically created bsModal
The header of my modalDialog is a reactiveValue. Once a certain input is changed within the modal, I would like the header to change. I have tried a few different ways and haven't been able to get it working seamlessly. The header either doesn't update, only updates if I close/reopen the modal, or causes the modal to re-render completely when the header is updated immediately.
Currently, I'm stuck on the last one (modal re-rendering completely). However, when I created the minimal, reproducible example (below), the header only updates if I close & reopen the modal.
ui<-fluidPage(
actionButton(inputId="model", label="Edit Model")
)
server<-function(input, output, session)
rv<-reactiveValues(header="Standard Model")
observeEvent(input$model,
showModal(
modalDialog(
fluidPage(
fluidRow(h3(rv$header)),
sliderInput(inputId="factor_1", "Factor #1", value=70, min=0, max=100),
sliderInput(inputId="factor_2", "Factor #2", value=30, min=0, max=100)
),
footer=modalButton("Save Weights"), size="s", easyClose=TRUE
)
)
)
observe(if (!is.null(input$factor_1))
if (input$factor_1!=70)
rv$header<-"Custom Model"
)
shinyApp(ui=ui, server=server)
Essentially, I want the title to change from 'Standard Model' to 'Custom Model' (without closing/reopening or re-rendering the modal) once the input for Factor #1 is changed for the first time.
r shiny modal-dialog
add a comment |
The header of my modalDialog is a reactiveValue. Once a certain input is changed within the modal, I would like the header to change. I have tried a few different ways and haven't been able to get it working seamlessly. The header either doesn't update, only updates if I close/reopen the modal, or causes the modal to re-render completely when the header is updated immediately.
Currently, I'm stuck on the last one (modal re-rendering completely). However, when I created the minimal, reproducible example (below), the header only updates if I close & reopen the modal.
ui<-fluidPage(
actionButton(inputId="model", label="Edit Model")
)
server<-function(input, output, session)
rv<-reactiveValues(header="Standard Model")
observeEvent(input$model,
showModal(
modalDialog(
fluidPage(
fluidRow(h3(rv$header)),
sliderInput(inputId="factor_1", "Factor #1", value=70, min=0, max=100),
sliderInput(inputId="factor_2", "Factor #2", value=30, min=0, max=100)
),
footer=modalButton("Save Weights"), size="s", easyClose=TRUE
)
)
)
observe(if (!is.null(input$factor_1))
if (input$factor_1!=70)
rv$header<-"Custom Model"
)
shinyApp(ui=ui, server=server)
Essentially, I want the title to change from 'Standard Model' to 'Custom Model' (without closing/reopening or re-rendering the modal) once the input for Factor #1 is changed for the first time.
r shiny modal-dialog
add a comment |
The header of my modalDialog is a reactiveValue. Once a certain input is changed within the modal, I would like the header to change. I have tried a few different ways and haven't been able to get it working seamlessly. The header either doesn't update, only updates if I close/reopen the modal, or causes the modal to re-render completely when the header is updated immediately.
Currently, I'm stuck on the last one (modal re-rendering completely). However, when I created the minimal, reproducible example (below), the header only updates if I close & reopen the modal.
ui<-fluidPage(
actionButton(inputId="model", label="Edit Model")
)
server<-function(input, output, session)
rv<-reactiveValues(header="Standard Model")
observeEvent(input$model,
showModal(
modalDialog(
fluidPage(
fluidRow(h3(rv$header)),
sliderInput(inputId="factor_1", "Factor #1", value=70, min=0, max=100),
sliderInput(inputId="factor_2", "Factor #2", value=30, min=0, max=100)
),
footer=modalButton("Save Weights"), size="s", easyClose=TRUE
)
)
)
observe(if (!is.null(input$factor_1))
if (input$factor_1!=70)
rv$header<-"Custom Model"
)
shinyApp(ui=ui, server=server)
Essentially, I want the title to change from 'Standard Model' to 'Custom Model' (without closing/reopening or re-rendering the modal) once the input for Factor #1 is changed for the first time.
r shiny modal-dialog
The header of my modalDialog is a reactiveValue. Once a certain input is changed within the modal, I would like the header to change. I have tried a few different ways and haven't been able to get it working seamlessly. The header either doesn't update, only updates if I close/reopen the modal, or causes the modal to re-render completely when the header is updated immediately.
Currently, I'm stuck on the last one (modal re-rendering completely). However, when I created the minimal, reproducible example (below), the header only updates if I close & reopen the modal.
ui<-fluidPage(
actionButton(inputId="model", label="Edit Model")
)
server<-function(input, output, session)
rv<-reactiveValues(header="Standard Model")
observeEvent(input$model,
showModal(
modalDialog(
fluidPage(
fluidRow(h3(rv$header)),
sliderInput(inputId="factor_1", "Factor #1", value=70, min=0, max=100),
sliderInput(inputId="factor_2", "Factor #2", value=30, min=0, max=100)
),
footer=modalButton("Save Weights"), size="s", easyClose=TRUE
)
)
)
observe(if (!is.null(input$factor_1))
if (input$factor_1!=70)
rv$header<-"Custom Model"
)
shinyApp(ui=ui, server=server)
Essentially, I want the title to change from 'Standard Model' to 'Custom Model' (without closing/reopening or re-rendering the modal) once the input for Factor #1 is changed for the first time.
r shiny modal-dialog
r shiny modal-dialog
asked Mar 6 at 22:04
Sean SlavinSean Slavin
278
278
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Using renderUI/uiOutput
:
library(shiny)
ui <- fluidPage(
actionButton("model", label = "Edit Model")
)
server <- function(input, output, session)
rv <- reactiveValues(header = "Standard Model")
observeEvent(input[["model"]],
showModal(
modalDialog(
fluidPage(
uiOutput("modalTitle"),
sliderInput("factor_1", "Factor #1", value=70, min=0, max=100),
sliderInput("factor_2", "Factor #2", value=30, min=0, max=100)
),
footer = modalButton("Save Weights"),
size="s", easyClose=TRUE
)
)
)
output[["modalTitle"]] <- renderUI(
fluidRow(h3(rv$header))
)
observe(
if (!is.null(input$factor_1))
if (input$factor_1 != 70)
rv$header <- "Custom Model"
)
shinyApp(ui=ui, server=server)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55032897%2fr-shiny-reactive-value-in-modal-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Using renderUI/uiOutput
:
library(shiny)
ui <- fluidPage(
actionButton("model", label = "Edit Model")
)
server <- function(input, output, session)
rv <- reactiveValues(header = "Standard Model")
observeEvent(input[["model"]],
showModal(
modalDialog(
fluidPage(
uiOutput("modalTitle"),
sliderInput("factor_1", "Factor #1", value=70, min=0, max=100),
sliderInput("factor_2", "Factor #2", value=30, min=0, max=100)
),
footer = modalButton("Save Weights"),
size="s", easyClose=TRUE
)
)
)
output[["modalTitle"]] <- renderUI(
fluidRow(h3(rv$header))
)
observe(
if (!is.null(input$factor_1))
if (input$factor_1 != 70)
rv$header <- "Custom Model"
)
shinyApp(ui=ui, server=server)
add a comment |
Using renderUI/uiOutput
:
library(shiny)
ui <- fluidPage(
actionButton("model", label = "Edit Model")
)
server <- function(input, output, session)
rv <- reactiveValues(header = "Standard Model")
observeEvent(input[["model"]],
showModal(
modalDialog(
fluidPage(
uiOutput("modalTitle"),
sliderInput("factor_1", "Factor #1", value=70, min=0, max=100),
sliderInput("factor_2", "Factor #2", value=30, min=0, max=100)
),
footer = modalButton("Save Weights"),
size="s", easyClose=TRUE
)
)
)
output[["modalTitle"]] <- renderUI(
fluidRow(h3(rv$header))
)
observe(
if (!is.null(input$factor_1))
if (input$factor_1 != 70)
rv$header <- "Custom Model"
)
shinyApp(ui=ui, server=server)
add a comment |
Using renderUI/uiOutput
:
library(shiny)
ui <- fluidPage(
actionButton("model", label = "Edit Model")
)
server <- function(input, output, session)
rv <- reactiveValues(header = "Standard Model")
observeEvent(input[["model"]],
showModal(
modalDialog(
fluidPage(
uiOutput("modalTitle"),
sliderInput("factor_1", "Factor #1", value=70, min=0, max=100),
sliderInput("factor_2", "Factor #2", value=30, min=0, max=100)
),
footer = modalButton("Save Weights"),
size="s", easyClose=TRUE
)
)
)
output[["modalTitle"]] <- renderUI(
fluidRow(h3(rv$header))
)
observe(
if (!is.null(input$factor_1))
if (input$factor_1 != 70)
rv$header <- "Custom Model"
)
shinyApp(ui=ui, server=server)
Using renderUI/uiOutput
:
library(shiny)
ui <- fluidPage(
actionButton("model", label = "Edit Model")
)
server <- function(input, output, session)
rv <- reactiveValues(header = "Standard Model")
observeEvent(input[["model"]],
showModal(
modalDialog(
fluidPage(
uiOutput("modalTitle"),
sliderInput("factor_1", "Factor #1", value=70, min=0, max=100),
sliderInput("factor_2", "Factor #2", value=30, min=0, max=100)
),
footer = modalButton("Save Weights"),
size="s", easyClose=TRUE
)
)
)
output[["modalTitle"]] <- renderUI(
fluidRow(h3(rv$header))
)
observe(
if (!is.null(input$factor_1))
if (input$factor_1 != 70)
rv$header <- "Custom Model"
)
shinyApp(ui=ui, server=server)
answered Mar 7 at 8:57
Stéphane LaurentStéphane Laurent
15.5k75696
15.5k75696
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55032897%2fr-shiny-reactive-value-in-modal-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown