Is there a way to handle the dynamic change of a dropdown for a single row in a grid-based datawindo
- by TomatoSandwich
Is there a way to handle the dynamic change of a dropdown for a single row in a grid-based datawindow?
Example:
NAME LIKABILITY PURCHASED IN COLOUR
(Text) (DropDown*) (Text) (Text)
Bananas [Good] Hands Yellow
[Bad]
[Bananas are good]
Apples [Good] Bags Red
[Bad]
Given the above is a grid-based datawindow, where the fields 'NAME','PURCHASED IN' and 'COLOUR' are text fields, where as the 'LIKABILITY' field is a dropdown*.
I say dropdown* because the same visual representation can be created by using a DropDownList (hardcoded within the datawindow element at design time), or a DropDownDW (or DDDW, a select statement that can be based on other elements in the datawindow).
However, there is no way I can get 'Bananas' having it's 3 dropdowns, while Apples has only 2.
If I enter multiple rows of 'Bananas', then all rows have 3 dropdowns, but as soon as I add an Apples row, all dropdowns revert to 2 selections.
To attempt to achieve this functionality, I have tried the following options:
--
1) dw_1.Object.likability.values("Good~tG/Bad~tB/Bananas are good~tDRWHO")
on ue_itemchange when editing NAME.
FAILS: edits all instances of LIKABILITY instead of the current row.
--
2) Duplicate Dropdowns, having one filtered, one unfiltered selection list per row, visible based on NAME selection.
FAILS: can't set visibility/overlapping columns on grid-based datawindow. (Source)
--
3) Hard-code display value as Database value, or Vice Versa. Have 'GOOD','BAD','BANANASAREGOOD' as the display and database values, and change handling of options from G, B, DRWHO to these new values.
FAILS: 3rd option appears for all rows, still selectable on Apple rows, which is wrong.
--
4) DDDW retrieve list of options for dropdown. Create a DDDW that uses the value of NAME to determine what selections it should have for the dropdown.
FAILS: edits all instances of the dropdown, not just the current row.
--
5) DDDW retrieve counter of options available (if B then 3 else 2), then have duplicate dropdown columns that protect/unprotect based on DDDW counter.
FAILS: Can't autoselect dddw value to populate column to cause protect on other two columns, ugly solution in any case.
--
There is now a bounty on this question for anyone who can give me a solution that will enable me to edit a dropdown column for a single row on a grid-based datawindow in PB 10.5