cancel
Showing results for 
Search instead for 
Did you mean: 

Adding '-Select-' on top for a drop down box

Former Member
0 Kudos

Hello,

I have a drop down box mapped to a field in the context, the field has some domain values and are populated in the run time. but I have to add another top row '-Select-' indicating to the client that the field need to be selected.

To add 'Select', I can write a method in the WDDOINIT method of the controller and also loop through the domain values and append to the drop down box. But I don't want to do too much of d/b interaction, as the fields are anyway loaded to the dropbox by mapping.

Is there a way in web dynpro, that we could do like in normal ABAP reports, to Loop at the screen and identify all the drop down boxes and add a 'select' row at the top?

I really appreciate any help.

Thank you

KV.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member485701
Active Participant
0 Kudos

Hi Kiran,

Can you make your requirement more clear to me?

As much I understand from your message is that you want to add a dynamic Text on the top of Dropdown.Like Select the field need to be selected.

from where you will get this field information?

what message you want to add?

If you have the field information then

(a)Create a textView on the top of Dropdown

(b) Bind it's property "Text" to the context attribute say Text .

(c) now set this value like

wdcontext.currentcontextelement().setText("Select "+field);

If this is not the right interpretation of your problem then please explain it in detail and tell me step by step what you want to do?

Regards,

Praveen

Former Member
0 Kudos

Hi Praveen,

Sorry for not explaining it properly, I'll try explaining it again.

I have a 'Dropdown by Key' object on a WebDynPro VIEW which is mapped to a field in the context. That field has data domain values of 'Yes' and 'No'.

So, in the run time, that dropdown by Key object is loaded with 'Yes' and 'No' values. All that I wanted to do is add '-Select-' to this list(that would be displayed in the dropdown box).

I cannot add '-Select-' to the domain values, I wanted to add this value to the list either in the component controller method or view method.

I would really appreciate if you can suggest any ideas to this.

Thank you

Kiran

sridhar_k2
Active Contributor
0 Kudos

Kiran,

If i understood your requirement, you want to set text to your Drop Down Control with some text.

Lets assume, testval is your context value which is binded to your DropDown. You can set text to the control like this, it is just adding simple text to that control.

wdContext.currentContextElement().setTestval("Select");

You can test the values, by getting

IModifiableSimpleValueSet values = wdThis.wdGetAPI().getContext().getModifiableTypeOf("testval").getSVServices().getModifiableSimpleValueSet();

Regards,

Sridhar

Former Member
0 Kudos

Hi,

Add this line in WDDoInit() method of view/controller

wdContext.currentContextElement.set<attributename>("-Select-");

Regards,

Murtuza

Former Member
0 Kudos

Hi,

You can create an element of the node binded to your dropdown and add set its value to SELECT and add this element to your dropdown node using

IPrivate<viewname>.I<nodename>Element ele = wdContext.node<nodename>().create<nodename>Element();

ele.set<attribute>("SELECT");

wdContext.node<nodename>().addElement(0,ele);

Warm Regards,

Murtuza