cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with dropdown by key in table

Former Member
0 Kudos

Hello All,

I have a table with 5 rows and 7 columns. 2 of the colums are dropdown by key and the remaining are input fields. I am able to populate the dropdown with values that are imported from a webservice model thanks to the folks here. However, everytime i choose a value from the dropdown, the remaining dropdown in the other rows will automatically be populatd with the same selected values as well. Will someone be able to explain where I may have gone wrong and what I can do to rectify the situation. Thank you very much.

from

Kwok Wei

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I’ve created node named 'table' for my table. Under that I’ve created two attributes 'name' and ‘age’. Now for the two columns with dropdown by key create two value nodes 'dropdown1' and 'dropdown2' under the main node 'table’. And also add attributes 'dattr1' and 'daatr2'under the two nodes dropdown1 and dropdown2 respectively.

Set the singleton property of the child node ’dropdown1’ and ‘dropdown2’ as false.

now the node structure would be like

---table(main node)

-


name (attribute1)

-


age (attribute2)

-dropdown1(valuenode for 1st dropdown by key)

---dattr1(attribute under dropdown1)

-dropdown2(valuenode for 2nd dropdown by key)

---dattr2(attribute under dropdown2)

Create the simple types for the two dropdown by key. And add the key value pair for each of the simple types created. Set the property of attribute dttr1 and dttr2 to the corresponding simple types created.

Now I’m creating two table elements which will make up for two rows in the table.

IPrivateDdapplcompView.ITableNode tabnode = wdContext.nodeTable();

IPrivateDdapplcompView.ITableElement tabelem = tabnode.createTableElement();

tabnode.addElement(tabelem);

tabelem.setName("rahul");

tabelem.setAge("21");

now using the above table element I’m pointing to the value nodes for the dropdownbykey columns.

IPrivateDdapplcompView.IDropdown1 c3n = tabelem.node Dropdown1 ();

IPrivateDdapplcompView.IDropdown1Element c3e = c3n.createDropdown1Element();

c3n.addElement(c3e);

IPrivateDdapplcompView.IDropdown2Node c4n = tabelem.nodeIDropdown2();

IPrivateDdapplcompView.IDropdown2Element c4e = c4n.createDropdown2Element();

c4n.addElement(c4e);

now create the next row like

IPrivateDdapplcompView.ITableElement tabelem1 = tabnode.createTableElement();

tabnode.addElement(tabelem1);

tabelem.setName("raj");

tabelem.setAge("22");

now as we did before

IPrivateDdapplcompView.IDropdown1 c3n1 = tabelem1.node Dropdown1 ();

IPrivateDdapplcompView.IDropdown1Element c3e1 = c3n1.createDropdown1Element();

c3n1.addElement(c3e1);

IPrivateDdapplcompView.IDropdown2Node c4n1 = tabelem1.nodeIDropdown2();

IPrivateDdapplcompView.IDropdown2Element c4e1 = c4n1.createDropdown2Element();

c4n1.addElement(c4e1);

after this you will be able to select different values from the dropdownbykey for different rows (under same column).

hope you have understood what i meant and it works for you.

thank you.

Former Member
0 Kudos

hello

this is the scenario,

ParentNode (Singleton)

--| attr1

--| ChildNode (non singleton)

-


| text

bind the dropdown by index texts properties to the ChildNode.text.

now the number of entries in the dropdown will be equal to the no. of elements of the ChildNode.

to create and add Parent element.


for(int i=0;i<5;i++)
{
IPrivate<View>.IParentNodeNode pnode = wdContext.nodeParentNode();
IPrivate<View>.IParentNodeElement pele = pnode.createParentNodeElement();
pnode.addElement(pelem);
pelem.setAttr("AAA"+(i+1));

now create ChildNode elements and add it to ChildNode.



for(int j=0;j<3;j++)
{
IPrivate<View>.IChildNodeNode cnode = pelem.nodeChildNode();
IPrivate<View>.IChildNodeElement cele = pelem.createChildNodeElement();
pelem.addElement(cele);
cele.setText("Car"+(i+1)+(j+1));
}
}

this code will create 5 rows and each row will have a drop down box with tree entries.

Eg: AAA1 -> Car11, Car12,Car13

AAA2 -> Car21, Car22,Car23 .....

hope this will help u.

regards,

Piyush.

Former Member
0 Kudos

Do you need different drop-down list entries in one table column? This is not possible with the *ByKey version because the DDIC type that contains the value set is the same for all table entries in that column. Nevertheless, you can have different selected keys for the column entries.

Armin

Former Member
0 Kudos

Hello Armin,

The dropdowns that I require are needed in individual colums (eg : column 6 has the dropdown for car models and column 7 has the dropdown for the year of the make.)

from

Kwok Wei

Former Member
0 Kudos

hello Kwok,

use drop down by index istead of dropdown by key.

create a node inside the node that u are binding to the table. now bind the child node to the texts property of the dropdown. now add elements to the child node to populate the dropdown. remember that the child nodes should be non singleton.

regards,

Piyush.

Former Member
0 Kudos

Hello Piyush,

Sorry to trouble you but do you have any sample coding snippets that will illustrate the use of dropdown by list ? I am terribly bad with java coding.

from

Kwok Wei