cancel
Showing results for 
Search instead for 
Did you mean: 

Regrding binding with a table

Former Member
0 Kudos

Hi all,

I have to bind result with a table.The result is in the form of 2-dimensional array.How i can create 2-dim array in context?How can i bind this with a table?

Please give me some idea about this.

Thanks all.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Suppose the result has 2 columns say name and age.

1.create a node say node_table

2.create 2 attributes name and age by right clicking the node and selecting create attributes

You will have to pass the values from array to node

Suppose the array is arr[][]

write this code in init of view by selecting implementation tab

for(int i=0;i<no of rows;i++)

{

ele = wdContext.nodeNode_table().createTabledataElement();

ele.setName(arr<i>[1])

ele.setName(arr<i>[2]) wdContext.nodeTabledata().addElement(ele);

}

Also right click on the transparent container in the layout of the view and apply template

select table and select the attributes you have to show in table in this case name and age

Hope this helps you

Regards

Rohit

Message was edited by: Rohit Radhakrishnan

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks to all for giving ur suggessions.

By

Madhu

Former Member
0 Kudos

Hi Madhu,

Since you are new this link may help to assign points

https://www.sdn.sap.com/irj/sdn/submitcontent?rid=/webcontent/uuid/e7b06b5c-0501-0010-3c80-f82a07c98... [original link is broken]

Hope this helps you

Regards

Rohit

former_member182372
Active Contributor
0 Kudos

Hi Madhu,

Yoe can not bind directly arrays to table. I would suggest you following approach:

1) create node without any attributes;

2) populate table and node dynamically with columns and attributes and bind them in wdDoModifyView with data from array (see appropriate tutorial "How to use dynamic programming in Web Dynpro applications?" https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/web dynpro tutorial and sample applications.faq#q-17);

3) create supply method for datasource node and fill node with node elements there with data from array.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

HI Madhu,

can u please explain ur requirement a bit clear.

what data you are getting and from where u are getting that data.how u want to display that data

Regards

Naidu