cancel
Showing results for 
Search instead for 
Did you mean: 

How display values as asterix in a dropdown field in WDJ ?

Former Member
0 Kudos

We need to display the values in a dropdown field as asterix ( * ) to the users.But the condition is when we save the details in a screen, the actual value came from backend ( present in the context attribute which is mapped to the dropdown) shoud be saved in the database as it is (and not in asterix format).

Please suggest me how to achieve this in WDJ.

Thanks,

Sitakanta Mohapatra

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

You can do the below steps,

Creation of a Simple-Type

1) Create a simple-type (choose the name according to your application) - Dictionaries -> Local Dictionary -> Data Types->Create simple type.

2) Choose the Enumeration tab page.

3) To add a new enumeration, choose New.

4) Under Enumeration Value, enter a value. Under Enumeration Text, enter some appropriate text.

Choose Finish to confirm.

5) Repeat steps 3 and 4 to create more enumerations.

6) Switch to the Representation tab page.

7) Under Field Label, enter an appropriate name.

😎 Under Quick info, you can give a tool-tip if needed.

Creation of a Context Attribute

1) Create a context attribute under the context-menu for your view where you need the drop-down.

2) On the Properties Page of the created attribute, choose the box at the end to open the

dialog for selecting the simple type for the type property.

3) Then, select Dictionary Simple Type and choose Dictionaries -> Local Dictionary ->

<package_name>.simpletypes. Choose the name of the simple type you just created and confirm

by choosing OK.

Completion of the View Layout

1) In the Outline tab of your view layout, select the drop-down that you have created. Switch to the Properties tab of the drop-down UI element

2) Set the selectedKey property to the Context attribute you just created.

If you have followed the above 3 steps, you will be getting a drop-down list which has as many values as the Simple Type created.

Former Member
0 Kudos

Hi,

In your node structure which holds the original value from the backend add one more attribute and set it's value to * and map this to your dropdown. Whenever you are writing back to database get the value from the context which holds the original value.

Regards,

Murtuza

former_member185086
Active Contributor
0 Kudos

Hi

Here Display and Saving logic will be different

Does Key and value of Dropdown are same? i.e Data coming from database are in from of Key & Value?

1. Create one simple type .

2. Bind it to Context and then Dropdown.

3. Dynamic populate data in this dropdown by using this code

//Node which will contain value of dropdown
IPublicAdminComp.IReturnGetAllDistrictElement district;

		IWDNodeInfo nodeinfo_dist = wdContext.nodeRegionDetails().getNodeInfo();

// Attribute which u binded to SimpleType
		IWDAttributeInfo attributeInfo = nodeinfo_dist
				.getAttribute(IPublicAdminComp.IRegionDetailsElement.DISTRICTCODE);
		ISimpleTypeModifiable districtYype = attributeInfo.getModifiableSimpleType();
		IModifiableSimpleValueSet valueSet_dist = districtYype.getSVServices().getModifiableSimpleValueSet();

 		valueSet_dist.clear();

//context node which contain the actual data  from database
		for (int i = 0; i < wdContext.nodeReturnGetAllDistrict().size(); i++)
		{
			district = wdContext.nodeReturnGetAllDistrict().getReturnGetAllDistrictElementAt(i);
                         // Will display value with * , we have used only for value if database requirement is key    //then no need to format it again (removing *),
                         String addastrict = "*"+district.getSalesOrgName();
			valueSet_dist.put(district.getSalesOrgCode(), addastrict);
                        
		}

4. See the comment in code

Best Regards

Satish Kumar