Skip to content

Commit

Permalink
Make filtering more intuitive
Browse files Browse the repository at this point in the history
  • Loading branch information
pixup1 committed Dec 8, 2024
1 parent fff7961 commit 21f695e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions R/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,19 @@ server <- function(input, output) {
"Fili\u00E8res :",
data()$Filiere,
multiple = TRUE,
selected = data()$Filiere,
)
)

filtered_data <- reactive({
filtered_data <- data()
filtered_data <- filtered_data[filtered_data$Filiere %in% input$select_filiere, ]
if (length(input$select_filiere) > 0) {
filtered_data <- filtered_data[filtered_data$Filiere %in% input$select_filiere, ]
}
filtered_data <- filtered_data[
grepl(tolower(input$filter_search), tolower(filtered_data[["Nom"]]), fixed = TRUE)
| grepl(tolower(input$filter_search), tolower(filtered_data[["Prenom"]]), fixed = TRUE),
| grepl(tolower(input$filter_search), tolower(filtered_data[["Prenom"]]), fixed = TRUE)
| grepl(tolower(input$filter_search), tolower(paste(filtered_data[["Prenom"]], filtered_data[["Nom"]])), fixed = TRUE)
| grepl(tolower(input$filter_search), tolower(paste(filtered_data[["Nom"]], filtered_data[["Prenom"]])), fixed = TRUE),
]
filtered_data
})
Expand Down

0 comments on commit 21f695e

Please sign in to comment.