Open flash0926 opened 1 week ago
Hello,
I added `` function to clear the the search, so now you can check that the search pattern is truthy and then search for it or clear the search, e.g. :
observeEvent(input$search, {
if (isTruthy(input$search)) {
searchTreeview(
inputId = "country",
pattern = input$search,
reveal_results = TRUE
)
} else {
clearSearchTreeview("country")
collapseTreeview("country")
}
})
Thanks!
According to the sample code, after adding this search function on the server side. By default, all levels will be expanded and all countries will meet the conditions.
searchTreeview( inputId = "country", pattern = input$search, reveal_results = TRUE )
I think it is the pattern field. When no search value is entered, the passed pattern is "", and the code will think that this "" can be matched by any string. I have tried to set it to NA or NULL, but the performance is abnormal. Setting it to NA is the same as setting it to "" Setting it to NULL, although it meets expectations in the default state. However, once a search is performed, the performance status will not be refreshed after resetting to NULL. How to deal with this?