on 04-01-2005 8:51 PM
SOMEONE CAN EXPLAIN ME HOW TO BIND A CONTEXT ATTRIBUTE TO THE SELECTEDKEY PROPERTY OF A COMBOBOX?
BELOW YOU CAN FIND SOME INFO ABOUT MY PROBLEM.
The DropDownByKey UI element needs a (view) context attribute where it's selected key may be stored.
From the Javadoc:
Data binding:
The set of selectable keys, displayed texts and the selected key are retrieved from a context. This context must provide an attribute y of a type having a value set. The selectable keys of the drop-down list are the keys of this value set, the displayed texts are the corresponding values. The currently selected key is the current value of the attribute y.
The property selectedKey must be bound to the attribute y.
So you have to provide such a context attribute, either one that has been created in the IDE or programmatically.
The value set then will be attached to this attribute such that the drop-down list may use them for the selection list.
hello,
to dynamically populate the values in the dropdown list, following sample code may help u.
first you have to create a value attribute in the context say "key" type string. bind this context to the 'selectedKey' property of dropdown box.
then get the attribute Info and using that info create the SimpleTypeModifiable.
now using this SimpleTypeModifiable get the ModifiableSimpleValueSet. this value set help you to enter the key and the value pair.
IWDAttributeInfo listInfo = wdContext.getNodeInfo().getAttribute("key"); // "key" is the context element.
ISimpleTypeModifiable simple = listInfo.getModifiableSimpleType();
IModifiableSimpleValueSet valueSet = simple.getSVServices().getModifiableSimpleValueSet();
valueSet.put("1","one");
valueSet.put("2","two");
valueSet.put("3","three");
valueSet.put("4","four");
// here "1" is the key and "one" is the text displayed.
now to get the the selected value in the dropdown,
String selectdKey = wdContext.currentContextElement.getKey();
hope this code might help u.
Regards,
Piyush
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I am sending the sample code hope this should help you out
<<"vaCtegory" String Value Attibute Name that is bound to the selected Key>>
first create a attribute info
second use that attrbuteinfo variable create a simpletype modifiable
third use simpletypemodifiable create a modifiableValueSet
and that variable gives you the option of having Key and Value Pairs.
IWDAttributeInfo aiCategory =wdContext.nodeVnFMRDetails().getNodeInfo().getAttribute("vaCategory");
ISimpleTypeModifiable stCategory = aiCategory.getModifiableSimpleType();
IModifiableSimpleValueSet vsCategory =stCategory.getSVServices().getModifiableSimpleValueSet();
for (int categoryId = 0;categoryId < wdContext.nodeEt_Wdrl_Categories().size();categoryId++) {
vsCategory.put(wdContext.nodeEt_Wdrl_Categories().getEt_Wdrl_CategoriesElementAt(categoryId).getCategory_Cd(),wdContext.nodeEt_Wdrl_Categories().getEt_Wdrl_CategoriesElementAt(categoryId).getCategory_Name());
}
Thanks
Krishna Kanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
There are two good tutorials, follow the below mentioned URL
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/unkown/web dynpro tutorial and sample applications.faq
How to enable value help?
How to use advanced value help: Object Value Selector?
Certainly these two tutorails explains your post..
Regards,
RK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First, why are you screaming?
There are two kinds of drop-down list boxes in Web Dynpro which differ in their type of data binding: *ByKey and *ByIndex.
The *ByKey elements use a context attribute with a DDIC type having a value set (key/value pairs). They display the values and allow for selecting a key.
The *ByIndex variant uses a set of context node elements, the selected element corresponds to the lead selection of the node.
The Javadoc given describes the *ByKey variant. I think it is very well written
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a simpletype in the local dictionary.
Provide enumeration in the simpletype if necessary.
Create a context attribute , bind it to the simpletype.
Map the attribute to the selected key propety of the dropdownbykey UI element..
Retrieve the value using the following code
wdcontext.currentcontextelement.get<attribute name>
Do send in your feedbacks
Regards
Noufal
Create a String context type. Add a value set the same way you do it here.
http://help.sap.com/saphelp_nw04/helpdata/en/86/16e13d82fcfb34e10000000a114084/content.htm
set the value of the context attribute value to whatever you want.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
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.