cancel
Showing results for 
Search instead for 
Did you mean: 

To populate values in Table

Former Member
0 Kudos

Hi,

I need to populate values in a table which i got from the bean...

i have retrived the values in Class[] and if i populate the table (as in code below).. i get only the first record..

i have created a value node (GroupNode) in the view context and iam binding the values to it from my Java Command Bean (CategoryBean)..

The code is as follows..

GroupDTO[] groupDTOs = wdContext.currentCategoryBeanElement().modelObject().RetSameCatidObj();

// Collection groupList = new ArrayList();

for(int i=0;i<groupDTOs.length;i++){

groupList.add(groupDTOs<i>);

IPrivateDel_sda.IGroupNodeElement ele = wdContext.createGroupNodeElement();

ele.setCategoryid(groupDTOs<i>.getCategoryid());

ele.setGroupid(groupDTOs<i>.getGroupid());

wdContext.nodeGroupNode().bind(ele);

}

Is there any workaround to solve the issue...

Thanx.

Shravan.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

I got it resolved by binding the table to a newly created node with all attributes as b4... nw it worked ,,,...

thanx for all ur replies ..

thanx 4 ur time..

Shravan.

Former Member
0 Kudos

Hi,

Instead of statement

wdContext.nodeGroupNode().bind(ele);

please use

wdContext.nodeGroupNode().addElement(ele);

Former Member
0 Kudos

Replace

wdContext.nodeGroupNode().bind(ele);

by

wdContext.nodeGroupNode().addElement(ele);

Armin

Former Member
0 Kudos

hi Armin,

I used this too...

This gives me only the first record...

Am I going wrong in the loopings.......???

Thanx 4 ur reply..

Shravan.

Former Member
0 Kudos

Really? Please post your code.

Armin

Former Member
0 Kudos

this my code which gives first record in the table


wdContext.currentCategoryBeanElement().modelObject().setCategoryid(wdContext.currentGroupbeanElement().getCategoryid());
GroupDTO[] groupDTOs = wdContext.currentCategoryBeanElement().modelObject().RetSameCatidObj();
for (int j = 0; j < groupDTOs.length; j++)
{
  IPrivateDel_sda.IGroupNodeElement ele =  wdContext.createGroupNodeElement(); 
  ele.setCategoryid(groupDTOs[j].getCategoryid());
  ele.setGroupid(groupDTOs[j].getGroupid());							
  wdContext.nodeGroupNode().addElement(ele);
}

thnxs 4 ur reply

shravan

Edited by: Armin Reichert on Jan 19, 2008 12:15 PM

Former Member
0 Kudos

How many elements does the array contain?

Armin

Former Member
0 Kudos

Hi,

The number of elements in the array is 6 fields..

but i need to show up only two fields in the table view..

Thanx,

Shravan

Former Member
0 Kudos

Please post the exact context structure including cardinalities. The code looks ok to me.

Armin

Former Member
0 Kudos

Hi,

the context has following elements to it...

node name:GroupNode

node Elements:categoryid,

groupid,

groupname

message,

status,

updatedby,

lastupdatedby

cardinality:0-n;

selection:0-1

do we need to use iterator methods to iterate between the records....

thanx..

Shravan.

Former Member
0 Kudos

With "node elements" you mean attributes, right?

Use the debugger to check how many elements the node "GroupNode" contains after the loop. What do you get?

Armin

Former Member
0 Kudos

Hi,

I debugged the code and found that groupNode has two records for it...

but in the table it shows only first record on the UI..

Thanx.

Shravan.

Former Member
0 Kudos

You are confusing me. First, you said that the array from which you fill the node contains 6 entries, then you say the node contains 2 elements and the table shows one entry?

Please check again:

- How many entries has the array from which you fill the node.

- How many elements contains the node after the loop?

- How did you bind the table against the node?

- Did you invalidate the result node after executing the backend call?

Armin

Former Member
0 Kudos

Hi,

My Node has 6 elements but iam populating only 2 elements (groupid and category id) to the table..

So number of node elements is 6 only when i debugged...

1) Array has 6 elements..it has only 2 records in db against it...

2) 6 Elements after the loop..

3) i have created a value node and i bound that view context value node to the table..

4) I am using EJBs to get the values from database...

thanx.

Shravan.

Former Member
0 Kudos

If we do not use the same language we will have trouble in communication.

In Web Dynpro we talk about context nodes, attributes and node elements.

You say "My node has 6 elements". What does that mean, 6 attributes or 6 node elements?

"Array has 6 elements, it has only 2 recors in db against it". I don't understand this sentence.

Please clarify.

Armin

Former Member
0 Kudos

Hi,

Sorry for not following the conventions...

My node has 6 attributes to it...

The array has 2 entries

[0] ={ grpid = "user 1" , gname ="gname1" , catid= "cat1",status="current",lastupdate = "18/1/08",updatedby = "user1"}

[1] ={ grpid = "user 2" , gname ="gname2" , catid= "cat2",status="current",lastupdate = "18/1/08",updatedby = "user1"}

Thanx.

Shravan.

Former Member
0 Kudos

Thank you. So the remaining problem is that your table shows only one row but the data source node contains 2 elements?

Can you please tell in which method you are filling the data source node and how the data-binding of the table looks like?

Armin

Former Member
0 Kudos

Hi,

The code which i posted before is the code i wrote in onactionshow method of a button...

I thought this is sufficient to populate the table as i have bound the values to the context...

Is there any more to populate the values in table...

Actually iam new to this java developement, as i am a abap developer by prof..

Thanx.

Shravan.

Former Member
0 Kudos

The code looks ok to me. Which value has the "visibleRowCount" property of the table?

Armin