cancel
Showing results for 
Search instead for 
Did you mean: 

Table binding to context results in wrong order

Former Member
0 Kudos

hi all, i have the following problem:

In the controller context, I have a value node with value attributes. The context is filled with data by the wdInit() method.

in the view context, i have mapped the the node to the coresponding controller context.

now when I create a table in the view and bind it to the context node, the data is shown. however, the sequence is all messed up, i.e. the values I added first are now shown on third place (third row) and so on. no alphabetic ordering either, its all messed up. any ideas?

regards, stephan

Accepted Solutions (1)

Accepted Solutions (1)

pravesh_verma
Active Contributor
0 Kudos

Hi Stephan,

First of all Welcome to SDN Community!!

Now abt your question..

You can simple order the the column values by ordering of the cloumn in the Outline View of your selected view.

<b>Right Click the table column -> Press Move up.</b>Save and re-deploy.

I hope this helps you.

Regards,

Pravesh

Ps: Please consider rewarding pints for helpful answer.

Former Member
0 Kudos

thanks for your answers

@oj: yes, my code in the wdDoInit method looks like yours. it's not populated in the view controller though, I use the component controller for that and have the view context then being mapped to the component context.

@pravesh: I am not talking about the ordering of the columns, but of the rows.

Former Member
0 Kudos

Please post the code that populates the context.

Armin

Former Member
0 Kudos

this is what's happening in the wdDoInit method

someBOL is a class that I use for building my data (as it is a prototype at this point)

	

IPrivateLogAnalysis.IComponentElement newComponentNodeElement;
 
someBOL.initialize();
Collection components = someBOL.getComponents();

for (Iterator iter = components.iterator(); iter.hasNext();) {
		SomeBOL.Component comp =
			(SomeBOL.Component) iter.next();

		newComponentNodeElement = wdContext.createComponentElement();
		newComponentNodeElement.setName(comp.getName());
		newComponentNodeElement.setSID(comp.getSid());
		newComponentNodeElement.setInstance(comp.getInstance());
		newComponentNodeElement.setHost(comp.getHost());
		newComponentNodeElement.setHostName("hostname");

		wdContext.nodeComponent().addElement(newComponentNodeElement);

	}

Former Member
0 Kudos

This adds the node elements in the order defined by the iterator of the collection "components".

Is this a sorted collection or what order do you expect?

Armin

Former Member
0 Kudos

thanks, i totally forgot, that the getComponents() method returns a HashHap which is not sorted. so, this has nothing to do with web dynpro. thanks for your help!

Answers (1)

Answers (1)

MG3
Contributor
0 Kudos

Hi Stephan

Does your populate code in the wdDoInit method look like this:

in a for loop:

for(int i=0; i<10; i++)
{
IPublic<ViewName>View.I<node>Element e = wdContext.create<node>Element();
    	
  e.setHeader("Hello");
  e.setText("Text_"+i);
		  
  wdContext.node<nodename>().addElement(i,e);
}

or could you post the code where u populate it?

regards,

oj