I am trying to create an app, which has 7 different sidebar menu items with one input ID like menu_items_id and based on this selection I have to update another pickerInput which has the location filters with another input id which is region_select. So when any of the options out of the 7 options from the menu_items_id is selected, I want the region_select id to give only the approriate regions.
Also please note that the 7 different options is coming from df1 and the region_select is fed through df2 means two different sources. But the df2 has all the columns which df1 has but df1 does not have the region columns to it. I have tried multiple Observe and Observe Event options but nothing working out. All I want it how to create this reactive element and/or how to select the appropriate values when a region from pickerInput df2 is selected so that the menu_items_id will update the approriate options too.
For e.g. if Asia is selected from the pickerInput then the menu_items_id should only show options to Asia alone
observeEvent(input$p1, {
updatePickerInput(session = session, inputId = "region_select",
choices = grep(paste0("^",input$menu_item_id), rownames(df2$regions), value = TRUE))
}, ignoreInit = TRUE)
}