cancel
Showing results for 
Search instead for 
Did you mean: 

Reg: Dropdown by index

Former Member
0 Kudos

Hi

I have binded values to drop down by index with a simple type and defining enumeration. How can i delete the values in the dropdown through code...

Kindly suggest..

Thanks

Prasanthi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Normallly for Drop Down by index if you remove the element from the node it should work


IWDNodeElement nodeElement = wdContext.node<YourNode>().getElementAt(<index of theelement to remove>");

wdContext.node<YourNode>().removeElement(nodeElement);

Following is the code that you can use in case of DDbyKey



ISimpleTypeModifiable modifiable = wdContext.getNodeInfo().getAttribute("Your Attribute").getModifiableSimpleType();
	  ISimpleValueServices simpleValueServices = modifiable.getSVServices();
	  IModifiableSimpleValueSet simpleValueSet = simpleValueServices.getModifiableSimpleValueSet();
	  simpleValueSet.removeKey("<key that you need to remove>");

Regards

Ayyapparaj

Answers (2)

Answers (2)

Former Member
0 Kudos

sorry actually my dropdown was by key...so i used the code given by you for key....

but its giving null pointer exception...

I have craeted a drop down by key and i have created a simple type and given the values in the enumeration and binded this simple type to dropdown through a context attribute.

PradeepBondla
Active Contributor
0 Kudos

Hi,

I thing you are giving the key which doesnt exist in the drop down by key list. that is why its giving null pointer exception.

This code works fine.....Check the key which you are passing.

PradeeP

PradeepBondla
Active Contributor
0 Kudos

Hi,

When you use the drop down by index you will map texts property to context attribute to populate the data. when you want to delete the items from drop down by index, delete those from the mapped attribute.

is this you wanted? If i misunderstood then let me know...

PradeeP