Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com
Webdynpro ABAP

Table with sorting functionality



In this tutorial we are going to add sorting functionality to the table.

One way of doing this is create an event handler method for sort event of table UI element and in that event handler method get the data from context node, and identify the column chosen for sort and sort the data accordingly and set it back to the context node.

But I prefer using the sorting functionality provided by the table UI itself. All you need is to create an event handler method for sort event in Table.  

In that event handler method get the reference of the table and its table handle. Using the table handler trigger the method apply sort for triggering the sorting.

I have constructed a simple application to display the data in the form of table. The output of the application is as below.  Let’s go ahead and start adding the sorting functionality to the table.

Output:
clip_image002[6]


Create an event handler method for the sort event of the table UI element.
clip_image003[6]


Write the following code in the event handler method.

clip_image004[6]

Activate and execute the application:

Output:
Table can be sorted by any columns.
clip_image006[6]

About Arun

0 Comments:

Post a Comment

Powered by Blogger.