Hello All,
I need your guidance and assistance regarding the creation of a cascading dropdown interface that supports an unlimited or variable number of levels.
The purpose of the interface is to display data retrieved from a reference database table, where the values of the child level dropdowns are determined by the parentId field in the table. The cascading dropdown interface will be used to present hierarchical data from the reference database table. Each dropdown level represents a different level in the hierarchy, with the child level options being dynamically populated based on the selected value of the parent level. The goal is to enable users to navigate through the hierarchy seamlessly, regardless of the number of levels it comprises.
The database table looks like this . ParentId is FK refer to Id field.
Id, level parentId
1 l1v1 null
2 l1v2 null
3 l1v3 null
4 l2v1 1
5 l2v2 1
6 l2v3 2
The problem is currently it is just for 2 level but n future client can add ( through admin functionality) more levels in the hierarchy.
I would like to make the cascade dropdown flexible enough to handle the future data. The child levels dropdowns will keep on appearing until one of the parent level has no child level values in the database.
I would greatly appreciate it if you could share your insights and suggestions on how to implement this.
Regards,
Surjit
Discussion posts and replies are publicly visible
I'd like to understand the business requirement that inspired this question because in practice, I've rarely seen nested dropdowns that are more than 2 levels deep. It's usually simpler to hard code nested dropdowns than to try to concoct some sort framework to handle what you are describing above.