Open micboat opened 5 months ago
Hi
Am not sure how to ensure that muni_filter shows only "A" to "E" as choice to select from after selecting "North" in region_filter. Is that possible with crosstalk. Here is my example in R,
df <- data.frame( region = rep(c("North", "South", "East", "West"), each = 5), muni = c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T"), value = runif(20, 10, 100) )
sd <- SharedData$new(df, key = ~muni, group = "shared_group")
region_filter <- filter_select( id = "region", label = "Select Region:", sharedData = sd, group = ~region, multiple = FALSE )
muni_filter <- filter_select( id = "muni", label = "Select Municipality:", sharedData = sd, group = ~muni, multiple = FALSE )
filter_panel <- bscols( widths = c(4, 4), region_filter, muni_filter )
Hi
Am not sure how to ensure that muni_filter shows only "A" to "E" as choice to select from after selecting "North" in region_filter. Is that possible with crosstalk. Here is my example in R,
Sample data
df <- data.frame( region = rep(c("North", "South", "East", "West"), each = 5), muni = c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T"), value = runif(20, 10, 100) )
Create shared data objects
sd <- SharedData$new(df, key = ~muni, group = "shared_group")
Region filter
region_filter <- filter_select( id = "region", label = "Select Region:", sharedData = sd, group = ~region, multiple = FALSE )
Municipality filter
muni_filter <- filter_select( id = "muni", label = "Select Municipality:", sharedData = sd, group = ~muni, multiple = FALSE )
Arrange the filters in a column layout
filter_panel <- bscols( widths = c(4, 4), region_filter, muni_filter )