Best way of implement Dependent/Nested filter

Hi, I need a dependent single link filter field.

For example, I’ve

  • a list of countries.
  • have a Model where I can create cities which are connected to country
  • create a tour guide article where an editor can choose country & city. When a country is chosen, I would like to show cities from that particular country.

I guess it’s sort of a common scenario. what’s the best way to achieve this? I was thinking to write a plugin. In that case, how can I create the same UI like the dato cms native select box, is there any UI component?

Hi @rislam

if you need this kind of two steps filtering, then yes a plugin would be ideal. Since plugins are implemented as iframes that load a page from an external source, you can use whichever component you like for your select inputs.

As an alternative, you could define a single text field on the city model whose purpose is to join country name and city name in a single field and make it easier for editors to search by. You can then choose this field as the title field for the model.

So, when you have to choose a city, you can somehow filter by country too:

that’s a good alternative. However, As this is a pretty common use case, do you have any plan to add dependent dropdown behavior anytime soon?

Not yet :slight_smile: But you can open a new feature request here in!