dreamRs / shinyWidgets

shinyWidgets : Extend widgets available in shiny
https://dreamrs.github.io/shinyWidgets/
GNU General Public License v3.0
826 stars 153 forks source link

PickerInput search filter un-filters after a selection is made but text still in search box #266

Closed hlendway closed 4 years ago

hlendway commented 4 years ago

When using the pickerInput with the search bar functionality and mulitple-TRUE, if you type text in the search box it filters the possible inputs but once you select a value the drop down goes back to the entire list even though your search text is still there. So if you want to select two items you have to retype your search for it to filter the list back to what it was.

Here is a sample app where you can test this out:

Say you want to select dog6 and dog10, so you type "Dog" into the search bar. The list will filter to the 20 dog options listed, but as soon as you select dog6, the list returns to the full list with the cat options at the top while "Dog" is still in the search bar. So the user then needs to click into the search bar and delete the g for the filter to be active again and filter the list to just dog options. It would be quicker for the user (and I think expected functionality) if whatever is typed in the search box holds through as many selections as the user wants. I assume a check for a value in the search box is missing at some point in the code. Let me know if I can help debug or test. Thank you in advance for the help, great package!

image

library(shiny)
library(shinydashboard)
library(tidyverse)
library(shinyWidgets)

data <- reactivePoll(3600000, NULL,
                     checkFunc = function(){Sys.time()},
                     valueFunc = function() {
                       read_csv("http://hci.stanford.edu/cs448b/data/florida-voting/fl2000.csv")
                     })

ui <- dashboardPage(skin = "black",
                    dashboardHeader(
                      title="Test App"
                    ),
                    dashboardSidebar(
                      sidebarMenu(id = "sidebar"),
                      pickerInput(
                        inputId = "testPickerInput",
                        label = "Select Some :",
                        choices = c("cat1","cat2","cat3","cat4","cat5","cat6","cat7","cat8","cat9","cat10",
                                    "cat11","cat12","cat13","cat14","cat15","cat16","cat17","cat18","cat19","cat20",
                                    "dog1","dog2","dog3","dog4","dog5","dog6","dog7","dog8","dog9","dog10",
                                    "dog11","dog12","dog13","dog14","dog15","dog16","dog17","dog18","dog19","dog20"),
                        options = list(
                          `actions-box` = TRUE,
                          `live-search` = TRUE,
                          `virtual-scroll` = 10,
                          `multiple-separator` = "\n",
                          size = 10
                        ),
                        multiple = TRUE
                      )
                    ),
                    dashboardBody(

                    )
)

server <- function(input, output, session) {

}

shinyApp(ui = ui, server = server)
pvictor commented 4 years ago

Hello,

If you update shinyWidgets from CRAN, it should work as expected. Let me know if it doesn't.

Victor

hlendway commented 4 years ago

Hi @pvictor ,

Thank you for the very quick response. Apologies if I missed that in a release report. I've tested it in my app and it works perfectly. My users will be thrilled thank you so much for getting this change into the current release this feature will be greatly appreciated!

Heather