on 08-14-2006 2:59 PM
Hi
I have a drop down by key and assigned a simple type to it and have 4 options in that simple type. and i bound that DropDownByKey element to a model attribute but i am not getting any value in that attribure i have not written any code to get selected value do i need to write it or automaticaly i will get it
Thanks
Ninad
Hi Ninad,
If you want to show static values in your DropDownByKey take simple type. And make your context variable to type of that simple type. and add this variable to your Drop Down by key control.
If you want to show model values in your DropDown use below code.
IContextElement contextElement = wdContext.currentContextElement();
IWDNodeInfo nodeInfo = wdContext.getNodeInfo();
IWDAttributeInfo dateAttributeInfo = nodeInfo.getAttribute(contextElement.empCode);
IModifiableSimpleValueSet dropValueSet = dateAttributeInfo.getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();
String empCodeTxt=null;
//Gives the Size of the List, which is coming from Model
int nodeLength = wdContext.node<BAPIList>().size();
for (int i = 0; i < nodeLength; i++) {
// Gives the Value, Which you want to show in Drop Down List Box.. Change it according to your need.
empCodeTxt=String.valueOf(((IPrivate<viewname>.I<BAPIList>Element)(wdContext.node<BAPIList>().getElementAt(i))).get<Parameter>());
dropValueSet.put(empCodeTxt, empCodeTxt);
}
Hope you understand this.
Regards,
Sridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you mean that when the user selects a value from the DropDownByKey, the value is not set in the corresponding context attribute? You should not have to write code to set the value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ninad,
You can get the current selection by the statement:
String selected_key = wdContext.currentContextElement().get<your_attribute_name>();
This will return you key value;
To get the corresponding text for the key, use the following code:
String attributeName = IPrivate<your_view>View.IContextElement.<your_simpletype_attribute>;
IWDAttributeInfo attributeInfo = wdThis.wdGetContext().getNodeInfo().getAttribute(attributeName);
ISimpleType simpleType = attributeInfo.getSimpleType();
ISimpleValueSet valueset = simpleType.getSVServices().getValues();
if(null!=selected_key)
String text_value = valueset.getText(selected_key);
'text_value' will have the corresponding text.
Hope this helps you,
Regards
Suresh
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.