Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Groups of Products in a Drop Down

    What is the best way to create groups in a select item (drop down)? Our data would look something like this:

    All
    -Group1
    --Product1
    --Product2
    --Product3
    -Group2
    --Product4
    --Product5

    Such that if Group1 is selected, then Products 1-3 would also be selected. The reverse would be true (unselect Group1, then Products 1-3 would be unselected). Also, if Group1 is selected, and then Product2 is unselected, then Group1 would not be selected, but Product1 and Product3 are.

    If there is no out-of-the-box setting for this behavior, we could manually do this if we could have access to the cached data for the optionDataSource. How can I access the optionDataSource data? (getClientPickListData() only returns the display and value fields, but the optionDataSource has additional fields we can use to determine this hierarchy.)

    We are using 8.2 Power Edition, and require Internet Explorer as our browser.

    #2
    Fair warning - this is a fairly radical departure from the default behavior of SelectItem so what might be required is to create your own ListGrid- or TreeGrid-based picker starting from eg StaticTextItem. This is because SelectItem has a bunch of keyboard handling and value management code based on the idea of selecting single or multiple items from a list, not a cascading selection in a tree.

    However to approach this based on customizing SelectItem:

    1. embed something in the data allowing you to know the indent of a given node and use formatCellValue() via pickListFields to render your indent

    2. use a recordClick or field.cellClick handler to implement your selection behavior

    Comment

    Working...
    X