79576152

Date: 2025-04-15 23:03:52
Score: 4
Natty:
Report link

After more slicing and dicing, I've found the problem. It's the existence of a selectizeInput.

I'll add a dummy selectizeInput to the minimal code below, which now demonstrates the filtering clearing issue.

Does anyone know how to get the filter clearing working properly while still using a selectizeInput?

#these are all the packages used in my real app, which I wanted to load for the minimal example
library(ggplot2)
library(tidyverse)
library(pool)
library(DT)
library(glue)
library(pool)
library(shinyjs)
library(stringr)
library(data.table)
library(lubridate)
library(shinydashboard)
library(rmarkdown)
library(shinyBS)
library(plyr); library(dplyr)
library(stringi)

# UI
ui <- navbarPage(useShinyjs(),
                 tabPanel(
                   titlePanel("DT Filters with Characters"),
                   DTOutput("filtered_table"),
                   actionButton("mybutton","testing"),
                   selectizeInput("test1", label = "nothing", choices = c("1")) #the problem
                 )
)  
# Server
server <- function(input, output, session) {
  
  names <- sample(c("Mike", "Dave", "Anna", "Sara", "John"), 11, replace = TRUE)
  
  results <- c("<1.3", ">20", "&50", "\"quoted\"", "'single'","semi;colon", "slash/", "\\backslash", "equal=sign","#hash", "comma,separated")
  
  data <- data.frame(Name = names, Result = results, stringsAsFactors = TRUE)
  
  output$filtered_table <- renderDT({
  
    datatable(
      data,
      plugins = "input",
      rownames = TRUE,
      filter = "top",
      options = list(pageLength = 10)
    )
  })
}


shinyApp(ui, server)
Reasons:
  • RegEx Blacklisted phrase (2): Does anyone know
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Dave916