Hello,
I am very new about asking questions in R so I hope I would be able to make myself understandable.
I am starting to use shinydashboard to develop a web application.
The main body of my dashboard is made of 2 parts:
-
a DT which has been obtained by filtering an initial DF (called 'df') thanks to some radioButtons available in the sidebar of the dashboard.
-
a box almost empty at the moment.
The user is allowed to select only one row of the DT. I would like to extract a value from the selected row and let it be the title of the box. I want the font to be the same as it would have been by writing simply title = 'Title' in box().
You will find the current code here below.
I succeeded to have the title of the box getting the right value.
However, I have a [1] before the value and the font is horrible and does not look like a title at all.
Any help please?
body <- dashboardBody(
sidebarLayout(
sidebarPanel(dataTableOutput("table"),width = 4),
mainPanel(
box(title = textOutput('product'), solidHeader = TRUE,status="primary", width = 12,
actionButton("Price", label="Price this product!")))
)
)
server = function(input, output) {
output$table <- DT::renderDataTable(df[df$Asset.Class==input$Asset_Class & df$Assets==input$Assets & df$Class==input$Class,c('Category','Product')],options=list(pageLength=10),selection='single')
output$product = renderPrint({
prod = input$table_rows_selected
product_name <- df[df$Asset.Class==input$Asset_Class & df$Assets==input$Assets & df$Class==input$Class,'Product']
product_name = product_name[prod]
if (length(prod)) {product_name}
})
}