on 07-20-2006 11:55 AM
Hello all,
I have a problem with DropDownListbykey for node and childnode.
The scenario is the following:
Context
-- NodeA
-
NodeB
-
IdB
-
NameB
-
IdA
-
NameA
I want to show the content of NodeA on dropdownlistbykey ddlA, and the content of NodeB on ddlB. When the user change the selected item of list ddlA, the ddlB has to change.
I use ISimpleTypeModifiable and IModifiableSimpleValueSet to create dinamically
the items for ddlB.
Actually, the child ddlB show only child of the first item of NodeA.
Has someone already implements a scenario like that ?
Thanks in advance.
MAX
Here is a working example using DropDownByIndex and a supply function for (singleton) subnode.
Context:
Nations (node, cardinality=0:N, selection=0:1)
-- Name (attribute, string)
-- Players (node, cardinality=0:N, selection=0:1, singleton, supply function = buildTeam)
---- Name (attribute, string)
Code in wdDoInit():
for (int j = 0; j < NATIONS.length; ++j)
{
INationsElement nation = wdContext.createAndAddNationsElement();
nation.setName(NATIONS[j]);
}
Code for supply function:
public void buildTeam(IPrivateDependentDDView.IPlayersNode node, IPrivateDependentDDView.INationsElement parentElement)
{
//@@begin buildTeam(IWDNode,IWDNodeElement)
buildTeam(node, parentElement.index());
//@@end
}
Code in section @@others:
private static final String[] NATIONS = {"Germany", "France", "Italy"};
private static final String[][] PLAYERS = {{"Lehmann", "Lahm", "..."},{"Barthez", "Sagnol", "..."},{"Buffon", "Nesta", "..."}};
private void buildTeam(IPrivateDependentDDView.IPlayersNode team, int teamIndex)
{
for (int j = 0; i < PLAYERS[teamIndex].length; ++j)
{
IPlayersElement player = team.createAndAddPlayersElement();
player.setName(PLAYERS[teamIndex][j]);
}
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the reply.
What I mean is, in the NodeA there are parent value of NodeB. When I select a value from the ddlA I want that ddlB shows only child values of NodeA element selected.
I use DDLbyKey with SVService for create simple type a runtime.
When I start the dynpro, ddlA show the first element of NodeA and ddlB show me the children of this element, correctly.
When I select an element on ddlA, nothing change on ddlB (even if I recreate the simpletype associated).
Maybe some bind operation is missing ?
MAX
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create one Node using the following code. Inside the DoInit() method
Step 1:
IWDNodeInfo multiplenode = multipleinfo.addChild("MultiNode" , null, true, false, true, true, false, true, null, null, null);
multiplenode.addAttribute("roles", "ddic:com.sap.dictionary.string");
Step 2:
Assign values for Dropdown
IWDNode node1 = wdContext.nodeNodeA().getChildNode("MultiNode", IWDNode.NO_SELECTION);
IWDNodeElement elem1;
for(int s=0;s<5;s++){
elem1 = node1.createElement();
elem1.setAttributeValue("roles","Value"+s);
node1.addElement(elem1);
}
Step 3:
Inside Domodifyview create IWDDropDownByIndex UI Element and Bind it.
IWDDropDownByIndex dropDownList = (IWDDropDownByIndex)view.createElement(IWDDropDownByIndex.class, "drop");
IWDAttributeInfo info = wdContext.getNodeInfo().getChild("NodeA").getChild("MultiNode").getAttribute("roles");
dropDownList.bindTexts(info);
dropDownList.setWidth("100");
Finally add this Dropdown into container. Like this you can create more Dropdown and add action to the dropdown as dynamically.
Kind Regards,
S.Saravanan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you want to display attributes of the node elements of NodeA and NodeB in the drop-down lists, use DropDownBy<b>Index</b>.
Armin
Message was edited by: Armin Reichert
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi MAX,
Could you explaine in more details.
Kind Regards,
S.Saravanan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.