You can test the development version of shiny
(
https://github.com/rstudio/shiny), which includes an implementation
of the server-side processing for selectizeInput(), and selectize
support auto-completion.
# in ui.R
selectizeInput('foo', choices = NULL, ...)
# in server.R
shinyServer(function(input, output, session) {
updateSelectizeInput(session, 'foo', choices = data, server = TRUE)
})
where 'data' is the character vector of choices (e.g. tens of
thousands of gene names in your case).
Regards,
Yihui
On Sat, May 17, 2014 at 11:49 AM, Marco Blanchette <
m...@stowers.org> wrote:
> Hi guys, just started to work with Shiny, love the product! this will change
> the way we do analyst at our Institute!
>
> I am not sure if this topic been brushed on before, but I would like to
> provide suggestions/autocompletion to user inputs. The challenge is that the
> lists will be very very longs (several tens of thousand choices, i.e. gene
> names from different species). I'd like to provide server-side generated
> suggestions to increase the response time but I am not sure what is the best
> solution.
>
> I wrote a custom widget that uses jquery_ui autocomplete and read a list of
> suggestion provide by the server. It works for short list (up to a few
> hundreds), but more than that, it becomes unusable. The strategy would be to
> hit a CGIs as the source that would parse the long list as a shorter one and
> send back a json formatted answer. However, I'm having some problem to
> understand the http server model used by shiny.
>
> Is is possible to trigger CGI response from the shiny www directory? (that
> would probably be optimal)
> Does someone has already solved that problem and has a suggestions?
>
> My personal widget with jquery capabilities:
>
> autocompleteInput <- function(inputId, label, value = "") {
>
> tagList(
>
> ## This makes web page load the JS file in the HTML head.
>
> ## The call to singleton ensures it's only included once
>
> ## in a page.
>
> shiny::singleton(
>
> shiny::tags$head(
>
> shiny::tags$script(src="jquery-ui-1.10.4.min.js"),
>
> shiny::tags$link(rel="stylesheet",
> href="jquery-ui-1.10.4.min.css"),
>
>
> shiny::tags$script(paste0('$(function() {$( "#',inputId,'" )
>
> .autocomplete({source:
> "./test.json",
>
> minLength: 3
>
> });
>
> });'))
>
> )
>
> ),
>
> shiny::tags$div(class="ui-widget",
>
> shiny::tags$label(label, `for` = inputId),
>
> shiny::tags$input(id = inputId, value = value)
>
> )
>
> )
>
> }