cancel
Showing results for 
Search instead for 
Did you mean: 

Scroll Container: Extracting value chosen

Former Member
0 Kudos

Hi,

I am trying to create a user entry form using WebDynpro and have added a 'ScrollContainer' to one of the views. Have then added several elements within the scroll container using type 'Label'.

Based on the label that the user selects in the form, I am looking to display that selection in another view. Could someone please provide me with the code that is required in order to achieve this?

Is this the right approach to use ScrollContainer by adding 'Labels' within the container which serves as user selection options?

Thanks a lot.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

No, a Label is used to label another UI element like an input field.

Can you describe exactly what you want to achieve?

Armin

Former Member
0 Kudos

Hi Armin,

I want to have a scroll container say for 'locations'. This container will have say multiple values from which the user can select - say USA, Germany, Japan, etc. Once the user selects the relevant location(s) (can select more than one value using 'Shift' key) and clicks say a 'Submit' button, the location(s) that were selected by the user is displayed in another view.

Please let me know if you have any other questions.

Thanks!

Former Member
0 Kudos

If you have NW04s, use a ListBox.

In NW04, use a Table with a single column.

Define a context node "Countries", cardinality 0:N, selection 0:N. Add an attribute "Name" of type "string".

Fill the "Countries" node:

final String[] COUNTRIES = { "USA", "Germany", "Japan" }; 

for (int j = 0; j < COUNTRIES.length; ++j)
{
  ICountriesElement country = wdContext.nodeCountries().createCountriesElement();
  wdContext.nodeCountries().addElement(country);
  country.setName(COUNTRIES[j]);
}

Create a Table T, bind property T.dataSource to node "Countries".

Create a TableColumn C, add cell editor (TextView) E, bind property E.text to attribute "Countries.Name".

Then your table will display one column with all countries and you can select multiple countries.

Add an action A to the view controller.

In the action handler, collect the selected table columns and do whatever:

void onA(...)
{
  List selection = new ArrayList();
  for (int j = 0; j < wdContext.nodeCountries().size(); ++j)
  {
    if ( wdContext.nodeCountries().isMultiSelected(j) ||
      wdContext.nodeCountries().getLeadSelection() == j )
    {
      selection.add(wdContext.nodeCountries().getElementAt(j));
    }
  }
  doWhatever(selection);
}

Armin

Former Member
0 Kudos

Hi Anirudh,

Adding to Armin's reply :

For NW2004, You can use an 'invisible' table inside the Scroll container and it would look exactly like a listbox. But the disadvantage would be the 'delay' in the selection of each row.

For making an 'invisible' table, these are the settings you need to do for the table UI element:

design - transparent

footer visible - false

read only - true

Now you can set the se;ection mode to 'multi' and use ctrl key to select multiple values.

Hope this helps you,

Best Regards,

Nibu.

Answers (0)