R shiny custom icon/image in selectInput

前端 未结 3 923
你的背包
你的背包 2020-12-23 23:29

I have the following code in my shiny application to give the user the possibly to choose what pointshape they would like to use on the plot.

selectInput(\"p         


        
3条回答
  •  温柔的废话
    2020-12-24 00:21

    Not a full answer, but need formatting:

    I have seen it before here: http://shiny.rstudio.com/gallery/selectize-examples.html. Look at the "Select a GitHub repo" input.

    Using the I() expression within a render call:

    selectizeInput('github', 'Select a Github repo', choices = '', options = list(
            valueField = 'url',
            labelField = 'name',
            searchField = 'name',
            options = list(),
            create = FALSE,
            render = I("{
          option: function(item, escape) {
            return '
    ' + '' + escape(item.name) + ':' + ' ' + escape(item.description) + '' + ' (by ' + escape(item.username) + ')' + '
      ' + (item.language ? '
    • ' + escape(item.language) + '
    • ' : '') + '
    • ' + escape(item.watchers) + ' watchers
    • ' + '
    • ' + escape(item.forks) + ' forks
    • ' + '
    ' + '
    '; } }"),

    Specifically the ' line.

    The issue now is to call a unique image for each option, which should also be possible within I().

提交回复
热议问题