cancel
Showing results for 
Search instead for 
Did you mean: 

Drop Down List should be populated with the previous search terms

Former Member
0 Kudos

Hi,

I have a requirement in my project for a Web Dynpro Java application. The requirement is that I have a Search View with two text fields and 3 drop down by key fields, a table conroller, and 3 buttons for Search, Export to Excel and Reset and the data being populated into the drop downs from the backend tables via an RFC call.

User will be allowed to enter the search terms either in the two text fields or by selecting the 3 values from the drop down.

In case if the user enters the search terms both in the text fields and by selecting the drop down lists, user should be displayed with a message and all the input fields should be populated with the earlier search terms entered by the user.

I am able to retrieve back the search terms for the text fields and all the 3 drop down lists are showing the first item of the drop down list. Here I want to show the user selected items.

I am unable to figure out how to achieve this.

Please help me out.

Thanks

Venkat

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Venkat,

When the user selects the values in the dropdowns and submits the search, before executing the search function/RFC save the Selected Key in some other context attribute and when you want to default the the dropdown selection to this value in the next search, set the selected key to this value by retrieving it from the context attribute.

e.g.

I have a dropdown by key and bind it to a context attribute say 'Attr' of the Simple Type having enumeration say (Valu-a,descripetion-A and Value-b,description-B). Then I can retrive the value selected in the dropdown by accessing that context attribute as follows:

String selectedValue = wdContext.currentContextElement().getAttr();

I can store this value in some other attribute say 'CopyValue':

wdContext.currentContextElement().setCopyValue(selectedValue);

Later, when I have to set the dropdown selection to previously selected value, then I can do it as follows:

wdContext.currentContextElement().setAttr(wdContext.currentContextElement().getCopyValue());

Regards,

Ajay

Former Member
0 Kudos

Hi Ajay,

Thanks for your prompt reply. Your clear explanation has resolved my issue.

I am awarding your points.

Thanks

Venkat