cancel
Showing results for 
Search instead for 
Did you mean: 

Get data from dropdownboxes in a table.

Former Member
0 Kudos

Hi experts,

My context is like this:

Context

---Countries(value node)

-


CountyCode(value attribute)

---Languages(value node)

-


language(value attribute)

-


Table(value node)

-


Version(value attribute)

My table with 25 rows contain 3 columns of 2 dropdowns(country and language) and one input field.

User can select data from n number of rows and click on submit. when he clicks submit I have to get the selected values from the table and pass it to my bapi which accepts this table input.

1.How can I get data selected data from the table with dropdowns.My dropdowns are not binded to the table node. Its binded to separate node outside tha table node as u can see.

2. How will I pass this table values to my BAPI.My BAPI accepts table as input.

Please give valuable suggestions(code).

Thanks

Anjana

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You could change your context structure to something like this:

Context:

TableRows (node, 0:N)
-- version (string)
-- countryCode (string)
-- language (string)

UI elements:

Table.dataSource = TableRows
TableColumn1.tableCellEditor = InputField, value = TableRows.version
TableColumn2.tableCellEditor = DropDownByKey, selectedKey = TableRows.countryCode
TableColumn3.tableCellEditor = DropDownByKey, selectedKey = TableRows.language

Modify the DDIC type of attributes "countryCode" and "language" to contain the available values in a value set. The effect is that the bound drop-down lists will contain these values automatically.

After having some rows selected, you can get them with code like:


for (int i = 0; i < wdContext.nodeTableRows().size(); ++i)
{
  if ( wdContext.nodeTableRows().isMultiSelected(i) )
  {
    ITableRowsElement row = wdContext.nodeTableRows().getTableRowsElementAt(i);
    row.getVersion(); // version in row i
    row.getCountryCode(); // country code selected in row i
    row.getLanguage(); // language selected in row i
  }
}

Armin

Former Member
0 Kudos

HI Armin,

Thanks a lot!Your solution worked....

~Anjana

Answers (1)

Answers (1)

sridhar_k2
Active Contributor
0 Kudos

This one is simple.

Let us assume your context nodes are

TestNode

test1

SampleNode

sample1

wdContext.nodeTestNode().getTestNodeElementAt(wdContext.nodeTestNode().getLeadSelection()).getTest1());

wdContext.nodeSampleNode().getSampleNodeAt(wdContext.nodeSampleNode().getLeadSelection()).sample1());

Regards,

Sridhar

Former Member
0 Kudos

Hi Sridhar,

I need to get the values in dropdown from the filled in rows of the table.

I have set the table property 'SelectionMode' to 'multiNoLead'

1. How can I get the values from individual row dropdowns?

I am facing one more issue here,

When ever I set the values for two or more rows, and click on 'submit' button, all the remaining rows gets filled in with the values from the last entered row.

I saw in a different post that I have to make the 'Singleton' of my dropdown node to false. Here in my case I am not able to do that because my dropdown node is under the context itself.

How can I solve this problem?

Thanks

Anjana