cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdownbykey: how to implement onSelect action

Former Member
0 Kudos

hi,

I have created an application where, a dropdownkey is created dyncamically and then, the two values Product1 and product 2 are created...on selecting any one product it navigated to another view with the help of onSelect.....

public void wdDoInit()

{

//@@begin wdDoInit()

IPrivateViewDropkey1.IDropKeyElement ele = wdContext.createDropKeyElement();

ISimpleTypeModifiable myType=wdThis.wdGetAPI().getContext().getModifiableTypeOf("DropKey.Key");

IModifiableSimpleValueSet val = myType.getSVServices().getModifiableSimpleValueSet();

val.put("1" ,"product1");

val.put("2" ,"product2");

//@@end

}

public static void wdDoModifyView(IPrivateViewDropkey1 wdThis, IPrivateViewDropkey1.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if(firstTime)

{

// creating tranparent container

IWDTransparentContainer tc = (IWDTransparentContainer)view.createElement(IWDTransparentContainer.class,"TransparentContainer");

// creating dropdownkey

IWDDropDownByKey key = (IWDDropDownByKey)view.createElement(IWDDropDownByKey.class,"Dropkey");

key.bindSelectedKey("DropKey.Key");

key.setWidth("60");

key.setVisible(WDVisibility.VISIBLE);

//// key.setSelectedKey("1");

tc.addChild(key);

IWDTransparentContainer root = (IWDTransparentContainer)view.getElement("RootUIElementContainer");

root.addChild(tc);

IWDAction action = wdThis.wdCreateAction(IPrivateViewDropkey1.WDActionEventHandler.CLICK, "");

key.setOnSelect(action);

}

public void onActionClick(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionClick(ServerEvent)

//// String attr = (string)wdContext.currentContextElement().getAttributeValue("attr");

String value = wdContext.currentDropKeyElement().getKey();

if(value.equals("1"))

{

wdThis.wdFirePlugToViewDropkey2();

}

else if(value.equals("2"))

{

wdThis.wdFirePlugToViewDropkey3();

}

//@@end

}

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Is this a question or an example of how to do it?