cancel
Showing results for 
Search instead for 
Did you mean: 

Add new row in Table with dropdown

Former Member
0 Kudos

Hi,

I have this layout:

A Table consist of -

Column 1 : Name (inputfield)

Column 2 : Country (dropdownbyindex)

2 Button :

Add - To add new row

Delete - To delete selected row

I have create a node (Resources) with 2 value attribute inside the node at the Context, name with type String & country with type reference to Dictonary simple type string (with a list of country).

When Add button is click, the table will have new row added with a preloaded list of country.

Is it possible to do that? How am i suppose to do?

Rgds,

Rayden

Accepted Solutions (1)

Accepted Solutions (1)

former_member193726
Active Participant
0 Kudos

Hi Rayden,

Thanx for trying out my suggestion.

As the dropdown is empty, will you please try replacing the dropdownbyIndex UI Element with DropdownbyKey UI Element?

This should solve your issue.

Regards,

Rekha Malavathu

Former Member
0 Kudos

Hi Rekha Malavathu,

Great.. Thanks. You solve my problem.

Just for discussion, What the different between dropdownbyindex & dropdownbykey? When do i use dropdownbyindex or dropdownbykey?

How come i don't get any for selection when i use dropdownbyindex?

Regards,

Rayden

Answers (3)

Answers (3)

former_member193726
Active Participant
0 Kudos

Hi Rayden,

Dropdown by key is a UI element which is having key-value pair. You can put this key- value using the SVS service or from the dictionary simple type.

One context variable(not a node) is sufficient to store all the values for this.

If u r using dictionary values, assign the dictionary type to this context variable.

For SVS, load the values to this context variable using the code.

Then bind this context variable to DrodownbyKey's Value.

For a dropdown by key, after loading the values( either from dictionary or by SVS ) , if you get the value, you will be getting the key for the corresponding value.

In the same way, if u set a key present in dropdown, it will automatically display the corresponding value.

Dropdown by Index gets the value from node.There is no key-value pair. We can load the values to it in the same way we load values to a table.(ie. By from a context node)

Regards,

Rekha Malavathu

Former Member
0 Kudos

Hi Rekha Malavathu ,

That was very informative. Thanks alot.

Best Regards

Rayden

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

use the code to add a new row in the context node.

IPrivate<viewname>.I<contextnode>Element elem = wdContext.create<contextnode>Element();

wdContext.node<contextnode>.addElement( elem );

To populate values in the drop down you can write the code in wdDoInit() as

IWDAttributeInfo attributeInfo = wdContext.

node<NodeName>().

getNodeInfo().

getAttribute("<attr_name>");

IModifiableSimpleValueSet valueSet = attributeInfo.

getModifiableSimpleType().

getSVServices().

getModifiableSimpleValueSet();

valueSet.put("IN", "India");

valueSet.put("US", "America");

.

.

.

Regards

Abhimanyu L

Message was edited by:

Abhimanyu Lagishetti

former_member193726
Active Participant
0 Kudos

Hi Rayden,

Create an action for the Add Button.

Assumption:

My View Name:TestAWSCV

My Node Name:Emp

My Node Attr Name:Country

My Node Attr Name:Name

Write the following code in that method:

IPrivateTestAWSCV.IEmpNode node = wdContext.nodeEmp();

IPrivateTestAWSCV.IEmpElement ele = node.createEmpElement();

node.addElement(ele);

Hope this helps.

Regards,

Rekha Malavathu

Former Member
0 Kudos

Hi Rekha Malavathu,

That was helpful. I'm able to add new row but the dropdownlist seem to be empty, it does not have any value for selection. Why is that so? Is it due with the context setting?

Best Regards,

Rayden