cancel
Showing results for 
Search instead for 
Did you mean: 

Adding table to a view

Former Member
0 Kudos

I have a start view and an result view.

On the result view table I would like to add a table with a few columns.

The data can also be static or hard coded since this is a prototype approach.

Can forum member's please advise on how to go about the same

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Create a context node say "Details"

Under that create to attributes "Name", "ID" of datatype string.

You can create the above context structure either in controller and map to the views or else you can create them in the view.

Now switch to the Layout of the view,

Right click on the view You will See "Template"

select the table template and this wizard will guide you through the creation of the table.

To add some data to the context

in the init of the controller You have to do the following

for(int x=0; x<10; x++)

{

IDetailsNodeElement element = wdContext.nodeDetailsNode().createAndAddDetailsNodeElement();

element.setName("Abcd");

element.setID("123");

}

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Ayyaparaj

Your approach worked.I am able to see a table in my view.

However the code snippet you provided is having compilation issues

for(int x=0; x<10; x++)

{

IDetailsNodeElement element = wdContext.nodeDetailsNode().createAndAddDetailsNodeElement();

element.setName("Abcd");

element.setID("123");

}

1.>

Is this because i have added Details node to the context of the result view?

2.>

Is there any other thing i am missing?

Former Member
0 Kudos

Hi,

Is the complie issue for createAndAddDetailsNodeElement() method????

IDetailsNodeElement element = wdContext.nodeDetailsNode().createDetailsNodeElement();

element.setName("Abcd");

element.setID("123");

wdContext.nodeDetailsNode().addElement(element);

If so then you have to change the code a bit as mentioned above.

Is this because i have added Details node to the context of the result view?

You have to write the above code in the java file where your node exists.

Ex: If you have the node in the controller and mapped to the view, you have to write this code in the controller.

If the node is only in the view, obviously the code should be in the java file for the view.

Regards

Ayyapparaj

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Stride,

In the code given by ayyaparaj

change this

for(int x=0; x<10; x++)

{

IDetailsNodeElement element = wdContext.nodeDetailsNode().createDetailsNodeElement();

element.setName("Abcd");

element.setID("123");

wdContext.nodeDetailsNode().addElement(element);

}

The last sentence should be added in the code .

Former Member
0 Kudos

hai stride,

refer to these pdf files which will help you adding tables in view.Its give you the step by step method to add table.check it.

//important//

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-tec...

//additional//

https://www.sdn.sap.com/irj/sdn/?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#38

Former Member
0 Kudos

Hi Stride,

As mentioned earlier this is one of the approach , you can also refer to the sample codes provided by SAP these can be quite useful for learining webdynpro

Link:[https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2]

Thanks

Pankaj

Former Member
0 Kudos

Create a context node with the needed attributes in the component controller and map it from both view controllers. In the result view, add a Table UI element to the view layout, use the binding wizard for creating the table columns with suitable editors. That's it.

Armin