问题
The following code produces an empty selection box whereas I expected a list of state abbreviation + name pairs.
updateSelectizeInput(session, 'selectizer',
server=TRUE,
label=NULL,
choices = cbind(abb=state.abb, name=state.name),
options = list(render = I(
'{
option: function(item, escape) {
return "<div>" + escape(item.abb) + " " +
escape(item.name) + "</div>";
}
}'), maxItems=3, placeholder='Select a state')
)
This code does what I expect:
updateSelectizeInput(session, 'basic_selectizer',
server=TRUE,
label=NULL,
choices=paste(state.abb,state.name),
options=list(maxItems=3, placeholder='Select a state')
)
I would like to get the full power of render but can't seem to make it work. What am I doing wrong with the render version?
来源:https://stackoverflow.com/questions/38149266/shiny-server-side-updateselectizeinput-does-not-create-selection-list