on 08-16-2006 6:50 PM
Hi Friends,
I knwo how to populate dropdown using simple type, and providing valeus there.
How to do it programmatically to populate the dropdown values, instead of hardcoding the values?
Thanks
Nav
Hi,
Check ythis working code in case of node with attribute.
Let the structure is
node1
|
|att1
Let the cardinality of the node is 1:1 or 1:n
IWDNode n=wdContext.getChildNode("node1",0);
IWDNodeInfo nf=n.getNodeInfo();
IWDAttributeInfo attributeInfo =nf.getAttribute("att1");
//wdComponentAPI.getMessageManager().reportSuccess("AttributeInfo:"+attributeInfo);
ISimpleTypeModifiable countryType = attributeInfo.getModifiableSimpleType();
IModifiableSimpleValueSet valueSet = countryType.getSVServices().getModifiableSimpleValueSet();
for (int i = 0; i < 40; i++)
{
valueSet.put("ID"i,"Customer"i);
}
Regards,
Vijayakhanna Raman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am able to access the values in View controller context with
ISimpleTypeModifiable countryType1 = dataAttributeInfo1.getModifiableSimpleType();
but not with ,
IModifiableSimpleValueSet dropValueSet =
dataAttributeInfo.getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();
why is it so?
is it that with Nodes, I need to access through iSimpleTypeModyfiable?
Nav,
If you have to access node metadata (like attribute types) then:
wdContext.node1().getNodeInfo()
.getChild("node2")
.getChild("node3");
Valery Silaev
EPAM Systems
Nav,
Read one of my replies above: it is forbidden to modify type of mapped attribute. Just move your code from view controller to component controller, where original attribute defined.
Valery Silaev
EPAM Systems
Hi,
Let the structure is
node1>node2>att2.
Set the property of node2 singleton to false and cardinality to 1:n.
Then the code is.
IWDAttributeInfo attributeInfo2=wdContext.nodeNode1().getChildNode("node2",0).getNodeInfo().getAttribute("att2");
ISimpleTypeModifiable countryType = attributeInfo2.getModifiableSimpleType();
IModifiableSimpleValueSet valueSet = countryType.getSVServices().getModifiableSimpleValueSet();
for (int i = 0; i < 40; i++)
{
valueSet.put("ID"i,"Customer"i);
}
Regards,
Vijayakhanna Raman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can try using a DropDownByIndex. Then you could just manage the values programmatically via context elements.
http://help.sap.com/saphelp_nw04/helpdata/en/4a/8613e41629344194e4f40393740d51/content.htm
It's very interesting question: DropDownByIndex (DDI) vs DDK (DropDownByKey).
Here is how I usually choose between both:
if (I need not to have different values per row in table) {
if (I do not alter valueset || valueset is from R3) {
use DDK;
}
else if (I may alter valueset) /*Here I need to alter valueset*/
{
if (I'm creating dynamic UI controls)
use DDK; //it is simpler
else // Design-time controls
use DDI;
}
else {
use DDI;
}
}
else {
use DDI;
}
Valery Silaev
EPAM Systems
Nav,
Seems that you are modifying valueset of (mapped) attribute type in view controller. Just move your code to component controller, where attribute was originally defined.
Valery Silaev
EPAM Systems
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.