cancel
Showing results for 
Search instead for 
Did you mean: 

How to prevent hard-coded in multi-level category

Former Member
0 Kudos

For a multi-level categorization like this:

Cat1: <DropDownList1>

Cat2: <DropDownList2>

Cat3: <DropDownList3>

Cat4: <DropDownList4>

There are requiements like:

1 When selecting one item in Cat1. Some items of Cat2 will be filtered out, leaving items related to Cat1.

Same thing comes for Cat3 when continually select one item in Cat2.

2 When I select one item in Cat3 directly. Cat2,cat1 items will be selected automatically.

It seems not difficult to implement this, just onact to select event and loop other drop down list and filter/display.

But, considering future change in number of category. Maybe 3 or 5 drop down lists are needed, hard coding is not GOOD.

So please does anyone have any idea that when number of category is changed, less code need to be modified ?

Accepted Solutions (1)

Accepted Solutions (1)

ChrisPaine
Active Contributor
0 Kudos

Hi Vincent,

although it would be possible to build dynamic code to generate the required number of dropdown selections, and context node to populate them with, the issue would be representing the data that you wanted to have dependencies on in a flexible manner.

The more I think about it, the more I think the underlying data would have to be represented as a tree type structure. (A context node that includes a representation of itself as a subnode)

When I think about that, I wonder - perhaps rather than having multiple dropdowns dynamically created, perhaps a simple heirarchical table display - where you could drilldown into the option that you wanted. In this case you could easily have different level of selection in different areas of the tree. An attribute of the final level ("I am a leaf node" ) could indicate easily to any checking routine that the correct depth of selection had been made.

Otherwise - you could build populate the dropdowns using dropdown by list - and binding to the recursive context - in very much the same way as you build recursive contexts for tree/hierarchical table type displays. You'd just have to do some dynamic coding.

Hope this helps,

Cheers,

Chris

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Initially try to fill all the 5 drop downs by means of supply functions to make the action easier create a class method with five imports and tables write logic into that method such that what ever will be the action we shd get that filtered or related data in to tables ... and implement this method in the action of the drop downs.... try it in this way .....

Regards,

Sana.