2

I'm trying to add a textOutput to my modalDialog and it isn't working. Any help would be appreciated. I realize this isn't a working example but the app is insanely massive and I'm running out of time to create a mini example. I'm also fairly inexperienced with modalDialog. Everything works as planned except the textOutput - it simply doesn't show.

library(tibble)
library(dplyr)
library(lubridate)
library(tidyr)
library(DT)
library(digest)
library(DBI)
library(shinyjs)
library(highcharter)
library(pool) #devtools::install_github("rstudio/pool")
library(shinyFeedback)
library(summaryrow)

showModal(
 modalDialog(
  fluidRow(
   column(
    width = 3,
    h1("Expense"),
    numericInput(
      inputId = ns("payment_expense_a"),
      label = "Expense Payment by A",
      value = 0
    ),
    numericInput(
      inputId = ns("payment_expense_b"),
      label = "Expense Payment by B",
      value = 0
    ),
    h4(
      textOutput("attorney_paid_total") #This is sum of A and B payments
    )
   )
   ...
  )
 )
)
...
output$attorney_paid_total <- renderText({    
  paste0("Total Attorney Paid: XXX") #This will be reactive
})
...

Thank you.

Spencer
  • 107
  • 9

2 Answers2

2

You should use output$expense_paid_total and not output$attorney_paid_total as a textOutput id.

You do not have in the code which you provided any textOutput with id = attorney_paid_total. Therefore i assume the problem is with the incorrect id of the textOutput, and it should like:

...
output$expense_paid_total <- renderText({    
  paste0("Total Attorney Paid: XXX") #This will be reactive
})
...

Please next time provide reproducible example, without it noone can really help in your problem, just assume something...

Mal_a
  • 3,670
  • 1
  • 27
  • 60
  • I just typed it wrong when I added the code. I edited my question to reflect my typo fix. I also realize I need a working example but like I said in my question, I am a newbi with modal (I didn't write the app, just editing it) and I don't have time to create one. But thank you for pointing our the error, – Spencer Aug 25 '17 at 13:11
1

According to this I just had to wrap it in ns()

h4(textOutput(ns("attorney_paid_total")))

Spencer
  • 107
  • 9
  • Please provide a working example. Just wrapping by `ns()` is not sufficient, `ns()` is not even function exported from the shiny package. – martin Jun 23 '23 at 11:52