cancel
Showing results for 
Search instead for 
Did you mean: 

Lead Selection

Former Member
0 Kudos

hi

I have created a dropdown menu(by Key).I have populated the values by binding the "texts" property to an attribute "num" that i have defined to be of simple type string.

How can I set the lead selection for this dropdown.

Plz Help

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I think u mean to say that have u binded selected key property to "num".

For lead select u can set this attribute with any of the value which you have defined in simple type.

for eg.

I have three values in simple type and suppose "dynpro" is one of the value which i want to be selected by default .

so before ur view is being u can set the "num" attribute with dynpro.

i.e

wdcontext.currentcontextelement.setnum("dynpro");

regards

Surender Dahiya

Former Member
0 Kudos

Hi,

If u have binded with the value attribute "att", and the drop down values are say a->AA,b>BB,c>CC,d-->DD....then write this code in wdDoInit()

wdcontext.currentcontextelement.setatt("a");

it will set the value as AA in the dropdown.

Regards

-Sandip

Answers (4)

Answers (4)

Former Member
0 Kudos

hi......

well dynamically you can do it


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
  }

Now in the wdModifyView


 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);
//setting the selection to the first value
					key.setSelectedKey("1");
				tc.addChild(key);
			
				IWDTransparentContainer root = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
				root.addChild(tc);
    

//create an action called Click in the view
			IWDAction action = wdThis.wdCreateAction(IPrivateViewDropkey1.WDActionEventHandler.CLICK, "");
    
    
		
		key.setOnSelect(action);
	
		
	 
	
		}
    
	
    //@@end
  }

regards,

pinki

Former Member
0 Kudos

thanks Ayyapparaj

But please tell me how to populate a dropdown by index at design time(and not at run time).

I created a value node called "val" and created an attribute called num inside this value node. I bound this "num" to a simple type (of type string), In the enumeration of this simple type I have given the values I want to populate the dropdown with but the dropdown showed no values.

Plz help

Former Member
0 Kudos

You mix things up. DropDownByKey and DropDownByIndex have completely different data binding models.

You can create value sets at design-time using the dictionary type editor. These value sets then can be used by a DropDownByKey at runtime to provide its items.

For a DropDownByIndex you need a context node filled with elements which can only be done at runtime.

Armin

Former Member
0 Kudos

Hi,

Lead selection works only with Drop down by index as its bound to a node .

Regards

Ayyapparaj

Former Member
0 Kudos

Hi himanshu,

You can use the following methods to set the selection.

wdContext.node.setLeadSelection(-1).

Here (-1) indicates selection nothing.

rewards points if helpful

best regards

ep