using selectize.js plugin options in Shiny

940 views
Skip to first unread message

Herman Sontrop

unread,
Apr 16, 2014, 12:03:30 PM4/16/14
to shiny-...@googlegroups.com

Hi,

New versions of Shiny (>=0.9) offer input selection via selectize.js .

Selectize.js offers additional functionality based on Plugins e.g. "remove_button" or "drag_drop", see also here .

Is it possible to use this functionality? ( I use Shiny 0.9.1)

I hoped the following would work, unfortunately it didn't:

selectizeInput( ..... ,  options = I("plugins: ['remove_button']") )

If possible, what is the correct way of using these features?

kind regards, Herman

Yihui Xie

unread,
Apr 16, 2014, 12:22:26 PM4/16/14
to Herman Sontrop, shiny-discuss
Hi,

The options argument should be a list, and I("plugins:
['remove_button']") is a character string. Please try the minimal
example below:

library(shiny)
runApp(list(
ui = fluidPage(
selectizeInput(
'foo', 'FOO', LETTERS, multiple = TRUE, options = list(plugins =
list('remove_button'))
)
),
server = function(input, output) {}
))

If you want more plugins, just add their names to the list(), e.g.
list('remove_button', 'restore_on_backspace')

Regards,
Yihui

Herman Sontrop

unread,
Apr 16, 2014, 1:06:39 PM4/16/14
to shiny-...@googlegroups.com, Herman Sontrop
Ah great! It works now, thanks! :-)

Op woensdag 16 april 2014 18:22:26 UTC+2 schreef Yihui Xie:

Herman Sontrop

unread,
Apr 16, 2014, 1:37:33 PM4/16/14
to shiny-...@googlegroups.com, Herman Sontrop
....to those interested, when using the 'drag_drop' Plugin you need to add a link to jquery-ui.js

just before using selectizeInput add includeScript("www/jquery-ui.js"), in which the www directory is assumed to have a copy of jQuery UI (see https://jqueryui.com/)
Reply all
Reply to author
Forward
0 new messages