Update Shiny renderUI selection triggered by selection on other filter -
i have dataset containing 2 fields, product , customer. using renderui want give user option of selected either product or customer first. once product in product selected, filter should automatically update selections customer displayng customers available selecter product. possible that? when try, happens customer , product keek updating each other in loop... fail tell app if product has been selected, customer needs updated. since want custumer update product in case custumer selected first, re-update product , on...
this how trying ( auto() reactive , contains product , customer):
## product output$productselector<-renderui({ # depends on customer prod_1 <- as.character(unique(auto()$product[which(auto()$customer %in% input$customer)])) # choices prod_2 <- c(sort(unique(as.character((auto()$product)) ))) if (length(prod_1) > 0){ selectinput('product', 'product', prod_1, multiple = true, selectize = true) } else { selectinput('product', 'product', prod_2, multiple = true, selectize = true) } }) ## customer output$customerselector<-renderui({ cust_1 <- as.character(unique(auto()$customer[which(auto()$product %in% input$product)])) cust_2 <- c(sort(unique(as.character((auto()$customer)) ))) if (length(cust_1) > 0){ selectinput('customer', 'customer',cust_1, multiple = true, selectize = true) } else { selectinput('customer', 'customer',cust_2, multiple = true, selectize = true) } })
Comments
Post a Comment