Skip to content

Commit

Permalink
cleaning up col subsetting
Browse files Browse the repository at this point in the history
  • Loading branch information
dgkf committed Jul 9, 2022
1 parent 77536de commit d9e7366
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Maintainer: Doug Kelkhoff <[email protected]>
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.2
RoxygenNote: 7.2.0
Imports:
shiny,
ggplot2,
Expand Down
7 changes: 2 additions & 5 deletions R/shiny_data_filter_item.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ shiny_data_filter_item <- function(input, output, session, data,
style = 'float: right;',
shiny::icon("times-circle"))
),
shiny::uiOutput(ns("vector_filter_ui")))
shiny::uiOutput(ns("vector_filter_ui"))
)

ui <- shiny::eventReactive(module_return$column_name, ignoreNULL = FALSE, {
if (is.null(module_return$column_name)) column_select_ui
Expand Down Expand Up @@ -180,8 +181,6 @@ shiny_data_filter_item <- function(input, output, session, data,
# before removing, reset param values
session$sendInputMessage(ns("vector_filter-param"), list(value = 'null'))
module_return$column_name <- NULL

stopApp(session)
})

shiny::observeEvent(input$remove_filter_btn, {
Expand Down Expand Up @@ -216,8 +215,6 @@ shiny_data_filter_item <- function(input, output, session, data,
filter_log("providing data filtered by '",
module_return$column_name, "'", verbose = verbose)

print(col)

out_data <- if (!nrow(data())) data()
else {
out_data <- subset(data(), vector_module_return()$mask())
Expand Down
10 changes: 6 additions & 4 deletions inst/examples/basic_app/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ server <- function(input, output, session) {
shiny_data_filter,
"data_filter",
data = starwars2,
verbose = FALSE)
choices = c("height", "mass", "is_droid"),
verbose = FALSE
)

output$data_filter_code <- renderPrint({
cat(gsub("%>%", "%>% \n ",
Expand All @@ -42,12 +44,12 @@ server <- function(input, output, session) {
})

output$data_summary <- renderDataTable({
filtered_data()
},
filtered_data()
},
options = list(
scrollX = TRUE,
pageLength = 5
))
}

shinyApp(ui = ui, server = server)
shinyApp(ui = ui, server = server)

0 comments on commit d9e7366

Please sign in to comment.