on 12-04-2008 2:52 PM
Hi All,
I could not find such scenario described in the forum, I hope you can help me on this:
I have a table with three columns:
Column 1: Type -> Could be A or B.
Column 2: Name -> Some strings.
Column 3: Number -> A dropdown list of numbers.
Every element (row) in my node (table) can be either of type A or B. Depending on the type of the element, I need to show a different dropdown list (meaning I have two dropdown lists).
No matter what I try to do, both lists end up in the same dropdown list for both types.
Any ideas on how I can solve this ?
Thank you,
Have a wonderful day,
Shani
Context:
Rows (node, c=0:n)
-- Items (node, c=0:n, s=0:1, singleton=false)
---- text (string)
If you use this context structure, each row ("Rows" node element) has its own "Items" node. Thus every drop-down list table cell editor can have different entries per row.
For your special case you could implement a supply function "supplyItems" for node "Items" that checks the type of the parent "Rows" element and supplies its entries accordingly:
void supplyRowsItems(IRowsElement parent, IItemsNode node)
{
if (isTypeA(parent))
{
// fill node with items for type A row
}
else if isTypeB(parent))
{
// fill node with items for type B row
}
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Armin,
Thank you for your quick response, but I'm afraid I did not understand how to use your answer in my code.
Maybe I should be more specific in my description.
In my code, I define the dropdown list the following way:
IWDAttributeInfo attribSystInfo = wdContext.nodeSystemMappingData().getNodeInfo().getAttribute("NewSystem");
ISimpleTypeModifiable systType = attribSystInfo.getModifiableSimpleType();
systValueSet = systType.getSVServices().getModifiableSimpleValueSet();
After the definition, I just put the values I want in the systValueSet.
The value I show in this column may be one of the values from the list or an empty value in case that the user did not choose one of the values.
How can I bind two different lists to the same dropdown object ?
How can I do this using a supply function ?
Thank you,
Have a great day,
Shani
With a DropDownByKey as table cell editor you cannot achieve different list entries per row because the data type that stores the value set is the same for all rows. Therefore I propose a solution based on DropDownByIndex.
Just implement the supply function such that the subnode is filled with the list entries depending on its parent element (as my code sketches). If you want to have an empty entry in the list, set the selection cardinality of the subnode to 0:1.
Armin
Hi Armin,
Thank you very much for your great reply !
I am sorry I did not award you with points until now, but I was out of office for a very long time and did not have the chance to check your suggestion.
Now, that I've tried using the DropDownByIndex instead of DropDownByKey, I am still having some issues with the DropDownLists.
I am still using:
IWDAttributeInfo attribSystInfo = wdContext.nodeItems().getNodeInfo().getAttribute("text");
ISimpleTypeModifiable systType = attribSystInfo.getModifiableSimpleType();
systValueSet = systType.getSVServices().getModifiableSimpleValueSet();
and fill the systValueSet with the list values inside the supply method.
Can the above code be also used for DropDownByIndex ?
The problem is that the systValueSet contains the values of the list, but in runtime the dropdown list is empty.
Can you please help me find the missing step ?
Thank you,
Have a great day,
Shani
I was finally able to seperate the two lists
Thank you !!
But now I have another issue:
Since I am using the DDByIndex instead of the DDByKey, I can have only one value in the table instead of a key and value (when using DDByKey).
The thing is, that I need to "show" the user a value string that represents a key string (which I need to use eventually...).
Is there a way to do this using the DDByIndex ?
Shani
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.