Dynamic CMS Select + Custom Form Select

I have an interesting challenge where a client needs a cascading master/detail filter. Choosing an item in one Custom Form Select will trigger a CMS Filter and also filter the choices in a second Custom Form Select.

Choosing the master item ( e.g. “country” ) will show all of the matching items in the filter result. Specifying the detail item ( e.g. “city” ) will further constrain that list.

I’ve temporary rebuilt some parts of FS attributes with a custom code version to short circuit some of the problems, so these are the remaining issues in order of importance;

RE-INITIALIZING FS FILTER
When “country” is selected, I rebuild “cities” in custom code. I then need to re-initialize FS filter so that the associated Custom Form Select will work to affect the filter. Right now it doesn’t.

I’ve tried

window.fsAttributes.cmsfilter.init();

However this doesn’t remedy the issue.

CLEARING SPECIFIC FILTER-ITEM SETTINGS

When a Country and a City are selected they show as two tag indicators. When the Country is changed, I need to remove the City one automatically, but keep the Country filtered.

RE-INITIALIZING A CUSTOM FORM SELECT

Ideally, I’d re-populate the SELECT that the Custom Form Select is based on, and then have FS Custom Form Select re-initialize the dropdown accordingly. This might also fix the FS filter binding? Unsure of the underlying design.

TRIGGERING AN FS-FILTER UPDATE

In various scenarios I need to set the filter and then trigger an update. I’m hoping there’s an API mechanism to do the update, rather than pushing events.

Thanks!