Hi, I have created a Shiny app. But there is one part does not quite work as expected.
Objective: How do I set a 0 value to placeholder?
The purpose is when I am not selecting anything, I want this field to be set to 0.
Apparently this bit works well but when I set multiple = TRUE with a maxItems=5, that has become NULL when I am not selecting anything. And worst case is... this does not work in a condition filter
I added a dummy value in the choices to make it as 0.
But is that something I can do in the onInitialize to set a var value?
Extract.....
updateSelectizeInput(session,'CUSTOMER_ID',choices=c('Please select : '='0',sort(unique(data_1$cust_id))),selected='0',
options = list(
maxItems=5,
placeholder = 'Please select an option below:',
onInitialize = I('function() { var val = "0"; this.setValue(val); }')),
server=TRUE)
One approach could be to create a new reactive that checks the value of CUSTOMER_ID. If it's NULL, the reactive is 0, otherwise it takes on the value. Then, instead of referencing input$CUSTOMER_ID throughout your app, you can reference customer_id().