This is my first app, I'm trying to modify the code from a submitbutton to an actionbutton as recommended and allow further functionality. Ive tried numerous examples and I can't replicate the results that I get when using the submitbutton. The section of code commented out with eventreactive and using the action button is not working but the heldinput and output$Held section below works fine with the submit button. These sections pass some input$etc as arguments to a external function. Any help greatly appreciated
ui<-fluidPage(
tabsetPanel(
tabPanel ("Todays Buy Recommendations",tableOutput(outputId="Buy_List")),
tabPanel ("Currently in an uptrend",tableOutput(outputId="Trend")),
tabPanel ("Charts",
plotOutput("chart",width=1350,height=600),
hr(),
fluidRow(
column(2,
textInput(inputId="TickerName","Select Ticker",value="BHP.AX")
),
column(1,
submitButton("Retrieve Chart")
)
)
),
tabPanel("Current Portfolio",
sidebarLayout(
sidebarPanel(
dateInput(inputId="Date","Transaction Date",Sys.Date()),
numericInput(inputId="Number", "Number Traded",0),
textInput(inputId="Ticker","Enter a ASX followed by .AX",value="ÄSX.AX"),
selectInput(inputId="BSD","Buy Sell or Delete ",c("Buy","Sell","Delete","NULL"),selected= "NULL"),
textInput(inputId="Price","Price",value="0.00"),
submitButton("Submit Transaction")
# actionButton("do", "Submit ")
),
mainPanel(tableOutput("Held"))
))
))
server<-function(input,output){
#This section not working with action button
# heldInput<- eventReactive(input$do, {
# HoldAdjust(input$Date, input$Number, input$Ticker, input$BSD, input$Price)
# },ignoreNULL = FALSE
)
#
# output$Held <- renderTable({
# heldInput()
# })
#This section works fine with submit button
heldInput<-reactive(HoldAdjust(input$Date, input$Number, input$Ticker, input$BSD, input$Price))
output$Held <-renderTable(heldInput(),striped=TRUE,digits=3)
RecBuy$date <- format(RecBuy$date,'%Y-%m-%d')
output$Buy_List <-renderTable(RecBuy,striped=TRUE,digits=3)
TrendCF$date <- format(TrendCF$date,'%Y-%m-%d')
output$Trend<-renderTable(TrendCF,striped=TRUE,digits=3)
dataInput <-reactive({input$TickerName})
output$chart<-renderPlot({chart(dataInput())})
}
shinyApp(ui=ui,server=server)