Skip to Content
Former Member
Jan 30, 2008 at 06:55 AM

Table UI sort Automatically with respect to one column


Hi Experts,

My requirement is to call a Bapi from r/3 and show the result in a Table UI Element, here am doing a direct binding with the context attribute and table ui. Till now everthing is according to requirement .

Now further to it I have to automatically sort the table based on one attribute of the node say "Fpperiod". I am trying to sort the model node just after the ".....execute()" method,

1. I dont need any sorting/ filtering options in the View .

. wdContext			.nodeBapi_Get_Payroll_Result_List_Input()
				.nodeOutput()				.nodeResults_Out().sortElements(new Comparator()public int compare(Object x, Object y) {
					int iX, iY;

					IPublicTable.IResults_OutElement rx =
						(IPublicTable.IResults_OutElement) x;
					IPublicTable.IResults_OutElement ry =
						(IPublicTable.IResults_OutElement) y;
					iX = Integer.parseInt(rx.getFpperiod());

					iY = Integer.parseInt(ry.getFpperiod());
					while (rx.getFpperiod() != null && ry.getFpperiod() != null) {						rx.getFpperiod().compareTo(ry.getFpperiod());					}					return iY - iX;				}			}); 

But its not working, and also if anyone could help me how the "comapre() " works it would be of great help ...

Can anyone help me with it .

Thanks in Advance