Multiple dropdown synchronisation

How does that look when you change the ‘main’ category?

Does the sub-category ‘select’ item automatically show the selected item? And how do you tie the view to the selected item?

Is there some code you could share?