Reputation: 319
The objective of this query is to know:
Upvotes: 0
Views: 201
Reputation: 1712
There is no preferred approach towards this, the key factors to consider are -
What ever be the case you would need to implement your own logic to enable related behavior of the dropdown. This will be achieved by writing your own listener on each of the dropdowns. Outside the listener logic you will have to implement the enable/disable logic i.e. First dropdown is enabled by default but the subsequent dropdowns are enabled only on the prior dropdown selection.
Case 1: The information is available via related webservice call - In this case each drop down will make a service call and the filtering may happen based on passing the selection item from the previous dropdown (usually the case with country/state/city/zip logic).
Case 2: All information is available as hierarchical JSON or XML, you could implement path based selection logic where in options for the related dropdown is available as subtree of the parent selection.
Case 3: Information is not associative - In my opinion this is the worst scenario as you will have to write down the logic to implement information association and then relate it as Case 2 option.
If you have option of storing information, i would suggest to ingest the information as hierarchical structure in nodes forming an associated tree and then implement dropdown source as path.json (parent dropdown), path/.json as the first related dropdown as so forth.
Upvotes: 1