In the reproducible shiny application below, the searchable selectize field reorders values by the length of the character strings.
If I type 1 to the search field, 'Gears' appears above 'Cylinders' because the string is shorter.
However, I want them in the original order, i.e., 11 above 12 above 13.
A thread in the selectize repo suggests to add something like sortField: [{field: 'name', direction: 'asc'}], but I don't manage to add this in the shiny context. So adding options = list(sortField = list(field = 'name', direction = 'asc')) to selectizeInput() has no effect.
library(shiny)
choices <- c(
"11 Cylinders" = "cyl",
"12 Transmission" = "am",
"13 Gears" = "gear"
)
shinyApp(
ui = fluidPage(
selectizeInput(
"variable",
"Variable:",
choices
)
),
server = function(input, output) {
}
)
