cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic population of the drop down by key UI element on certain actions

Former Member
0 Kudos

Hi Experts,

I've an attribute of type(simple type) which is binded to a drop down by key UI element. The values in the drop down get populated from the enumerated values maintained in the Simple Type.

Now, I want to dynamically play with the values of the drop down based on certain actions. But I am not sure how to do that.

My requirement is that how can we remove the values and add them again in the dropdown based on certain actions as they are static values coming from the values maintained in the simple type.

Kindly suggest if it is possible to play with these values and share the code to achieve it.

Please note that the values are stored in the attribute when the component is instantiated.

Regards,

Anurag

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Anurag,

As per your requirement Using drop down by key is relevant and make sense, in real time we face the same scenario while some model attribute needs to be displayed in drop down. Here in such case you can't use the simple type and can not modify its type because its a model attribute. In such case as segmentation fault suggested we can use modifiable simple type. I am providing the sample code which we used in one of our project hope it helps.


IWDAttributeInfo custClassAttributeInfo = wdContext.node<Node Name>().getNodeInfo().getAttribute(
                        IPublic<Component Name>.I<Node Name>Element.<Attribute Name>);
        ISimpleTypeModifiable custClassType = custClassAttributeInfo.getModifiableSimpleType();
        IModifiableSimpleValueSet custClassValueSet = custClassType.getSVServices().getModifiableSimpleValueSet();
        for (int i = 0; i < wdContext.nodeReturnCustomerClass().size(); i++) {
            custClassValueSet.put(wdContext.nodeReturnCustomerClass().getReturnCustomerClassElementAt(i).getId(), wdContext.nodeReturnCustomerClass().getReturnCustomerClassElementAt(i).getName());
        }

Regards

Jeetendra

Former Member
0 Kudos

Thanks guys, the issue is resolved.

Regards,

Anurag

Former Member
0 Kudos

HI Anurag,

The best way you should handle this is through Drop Down by Index which can be populated dynamically.

Regards,

HImanshu

Former Member
0 Kudos

hi anurag

If it is possible as per your requirement u use drop down by index because in drop down by index u can control the values of drop down through coding.On certain action you can change the values of the drop down by index.

Make a node of 0-n cardinality add an attribute to it

Use that attribute to bind drop down by index.

For initialization write your code on wdinit to add initial values on drop down

and when you have to change values write in the any action where u want

Hope it works in your case.

Best regards

Suresh joshi

Former Member
0 Kudos

Search the forum for "getModifiableSimpleValueSet".