I'm trying to reproduce a minimal example of selectizeInput from here. I want to show "MPG:value" next to the car name in bold using render method (the last example of the page) but nothing shows up in the UI. How can I do this?
Here's the code:
ui.R
fluidPage(
fluidRow(
column(width = 5,
selectizeInput('cars', label = NULL, choices = NULL, options = list(
placeholder = 'Type a car name, e.g. Mazda', maxOptions = 5)
)
),
)
)
server.R
function(input, output, session) {
updateSelectizeInput(session, 'cars', server = TRUE,
choices = cbind(name = rownames(mtcars), mtcars),
options = list(render = I(
'{
option: function(item, escape) {
return "<div><strong>" + escape(item.name) + "</strong> (" +
"MPG: " + item.mpg + ") </div>";
}
}'))
)
}
