cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Drop Down creation using simple data types

Former Member
0 Kudos

Hi all,

I have got a requirement in which i have to create an iView which is going to have 6 drop down values and with in that 1 value is going to have sub values which needs to get displayed in the similar drop down fashion.

I have created a simple data type having enumeration of the 6 values and linked the same to iView with drop down by key which is working successfully. And for the purpose of sub values i have created a similar simple data type with two values and linked the same with a value attribute.

Well, can any one tell me the further process to proceed ?

Thanks in advance ...

Vipin

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Vipin,

There are quite some steps to achieve what you need. Since you have both your DropDownByKey elements defined and bound to context elements, it may make sense to keep the Second DropDownByKey element invisible and make it visible only when user selects a specified key from first DropDownByKey. To achieve this, follow these steps.

1. Create an action with a parameter "key" of type string.

2. Bind this action with onSelect event of your First DropDownByKey UI Element.

3. Do mapping of parameter "key" in your wdDoModifyView with following code.


  if (firstTime)
	  {
	    final IWDDropDownByKey dk = (IWDDropDownByKey)view.getElement("DropDownByKey1");
           // Replace DropDownByKey1 with id of your DropDownByKey Element.
	    dk.mappingOfOnSelect().addSourceMapping("key", "key");
	  }

4. Create a context attribute of type WDVisibility say "DDVisible" and bind to "visible" property of your second DropDownByKey.

5. Set DDVisible to NONE in wdInit().


wdContext.currentContextElement().setDDVisible(WDVisibility.NONE);  

6. In onSelect action write this code to make second visible

  
if(key.equalsIgnoreCase("Two")){
	//Replace "Two" with your required value. 
         wdContext.currentContextElement().setDDVisible(WDVisibility.VISIBLE);
	  }
	  else{
		  wdContext.currentContextElement().setDDVisible(WDVisibility.NONE);  
	  }

This should give the desired results.

Hope this helps.

Vishwas.

Former Member
0 Kudos

Hi

First create an Action OnSelect and bind it to the OnSelect Action of the first Dropdown by Key that you have created.

In the action get the value selected in the First Drop Down and according to the value selected fill the second drop down with the Sub Values

IWDAttributeInfo at = wdContext.getNodeInfo().getAttribute(IPrivate<>View.IContextElement.<>);

ISimpleTypeModifiable itemType = at.getModifiableSimpleType();

IModifiableSimpleValueSet valueset = itemType.getSVServices().getModifiableSimpleValueSet();

valueset.put( " " , " " );code}