cancel
Showing results for 
Search instead for 
Did you mean: 

add new value into table

Former Member
0 Kudos

Hello,

i want to make a small application that takes input value from the input field save it in the context and display it in a table.

The problem is that when i add a new data it is not added into context as a new data but the data stored in the context is overwritten and only one value is displayed in a table...

in the context i defined value node with value attribute and set the cardinality 1..n and selection 0..1

does anyone know what should i set to add new values in the context and then display them in a table?

Anyone can help?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Please post the code where you add the new element into the node.

Armin

Former Member
0 Kudos

ok, i thought that there some possibility to add the value in the list "automaticly".

So..Ive mapped the input field tih context and it works fine.. so to test how to add new value i put following code in the method onActionGoToUser:

IPrivateWelcomeView.IDataElement myElement = wdContext.createDataElement();

myElement.setLastname("test");

wdContext.addElement(myElement);

but now im becoming error that "must not add elements to a Node of cardinality 0..1 or 1...1"

Thanks for help!

Former Member
0 Kudos

Hi Karol,

Cardinality is a property that defines how many elements(rows) a particular node(table) can have.

So change the Cardinality property of the node to 0..n in the Context. Just for your information it can be changed at the controller in which you first created the Node and not in the mapped controller nodes.

Regards,

Shubham

Former Member
0 Kudos

Hi,

ive changed like you suggested but im still getting that error...

Karol

Former Member
0 Kudos

Hi Karol,

Sorry I missed something in your code

IPrivateWelcomeView.IDataElement myElement = wdContext.createDataElement();

myElement.setLastname("test");

wdContext.addElement(myElement);

Why are you adding the element to the root note?

You should add it to your node for which the Cardinality is 0..n

wdContext.node<YourNode>.addElement(myElement)

Regards,

Shubham

Former Member
0 Kudos

Hi Karol,

When u add a new element use the following code each time :

wdContext.addElement(0,myElement);

This will put your data in stack format in the table.

Hope this helps.

Regards,

Kshitij Agrawal

Former Member
0 Kudos

Thanks, this helped to avoid the error!!

but i still dont get the value in the table...

Thanks for help!!

Karol

Former Member
0 Kudos

sorry i meant

wdContext.node<YourNode>.addElement(0,myElement)

Regards,

Kshitij Agrawal

Former Member
0 Kudos

Thanks, this helped to avoid the error!!

but i still dont get the value in the table...

Thanks for help!!

Karol

Former Member
0 Kudos

Hi Karol,

Check the table data source. Is it binded to the node properly?

Regards,

Shubham

Former Member
0 Kudos

well.. i think ive mapped the Context data wrong..

wdContext.currentDataElement().setLastname(wdThis.wdGetWelcomeController().wdGetContext.currentDataElement().getLASTNAME);

so i think that only the first string value is passed and not all..

How to map value nodes?

Thanks for help!

Former Member
0 Kudos

In the layout tab.

For each column create a TableCellEditor.

For each TableCellEditor in the text property select the node value attribute you want to map to that particular column.

Then during display populate the node value attribute.

You shoould be able to map all fields using this.

Regards,

Kshitij Agrawal

Former Member
0 Kudos

well.. actually.. all fields are mapped in the table view. but only one value is displayed after deployment

Former Member
0 Kudos

Could you check if you are creating a node element each time

ur adding an element.

Former Member
0 Kudos

Does anyone have seen an example to download with two views with following scenario: On the first view there is an input form to insert datas and on the second table, that shows all data inserted by the user.

Thanks for info!!

Karol

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

It seems that you have to store all entered values in context.

Whenever you want to add new data into context you have to create new node element and bind it to context node.

It should automatically reflect in table if it is created from that node.

NEx