on 09-25-2008 6:23 PM
Hi ,
I am a beginner in Webdynpro , Java . Request you to plz help me ..
My requirements -
1. How to create a dropdownbyindex in a view and populate it with some static values passed to the Context .
2. Upon selection of a value from the dropdown and clicking on the Submit button , how to save the value?
Context -
Node - Season
Attribute - Seasonofyear
Kindly Reply
Thanks in Advance!!
Regards
Smita
Hi smitha,
Context -
Node - Season
Attribute - Seasonofyear
I had worked out ur same requirement with dropdownbykey and added the following code.
public void wdDoInit()
{
IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(IPrivateMain.IseasonElement.season);
ISimpleTypeModifiable sea = attributeInfo.getModifiableSimpleType();
sea.setFieldLabel("SEASON");
IModifiableSimpleValueSet valueSet =sea.getSVServices().getModifiableSimpleValueSet();
valueSet.put(0, AAA);
valueSet.put(1,BBB);
valueSet.put(2,CCC);
}
I think this may help you.
Edited by: kandha mugundhan on Sep 25, 2008 7:50 PM
Edited by: kandha mugundhan on Sep 25, 2008 7:52 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi smitha,
I had checked out.. this is working fine for ur requirement
public void wdDoInit()
{
IPrivateSamView.ISeasonNode snode = wdContext.nodeSeason();
IPrivateSamView.ISeasonElement sele = snode.createSeasonElement();
snode.addElement(sele);
IWDAttributeInfo attributeInfo = wdContext.nodeseason().getNodeInfo().getAttribute(IPrivateMain.IseasonElement.season);
ISimpleTypeModifiable sea = attributeInfo.getModifiableSimpleType();
sea.setFieldLabel("SEASON");
IModifiableSimpleValueSet valueSet =sea.getSVServices().getModifiableSimpleValueSet();
valueSet.put("0"," AAA");
valueSet.put("1","BBB");
valueSet.put("2","CCC");
}
i had created a attribute called copy under the node "season". Now i copied from the season attribute to copy attribute.
then onaction save
{
IModifiableSimpleValueSet rea = wdThis.wdGetContext().getContext().getModifiableTypeOf("season.season").getSVServices().getModifiableSimpleValueSet();
wdContext.currentSeasonElement().setCopy(rea.getText(wdContext.currentSeasonElement().getSeason()));
}
go thru this link to get an an idea for binding data incase of index and key
http://help.sap.com/saphelp_nw04/helpdata/en/74/450e8af57065468e88e4b86de47e4b/frameset.htm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi smitha,
Firstly in the view layout in the RootUIContainer
right click -> select Insert child - > select DropDownByIndex. Bind the Value property
of dropdown with ur node Seasons- Seasonofyear.
Then in the implementation write:-
IPrivat<>View.ISeasonNodeElement Season_element - wdcontext.createseasonElement();
Season_element.setseasonofyear("Summer"); //insert all the values like using Set method
wdcontext.nodeSeason().addElement(Season_element);
This shall populate all the values in the dropdown.
On selecting a particular value from the dropdown if u want to retrieve
the value . Bind an event handler with the onSelect Action of dropdown UI
element. In the event handler just write :-
String seasonofyr = wdcontext.currentseasionNodeElement().getseasionofyear();
This strin variable shall collect the value of season currently selected.
Hoep this helps you.
Thanks
Namrata
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.