Shiny server-side updateSelectizeInput does not create selection list

杀马特。学长 韩版系。学妹 提交于 2019-12-12 17:45:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!