cancel
Showing results for 
Search instead for 
Did you mean: 

sorting functionality for Table UI

Former Member
0 Kudos

Hi all,

I have created a table in my WDA application.

I want to add SORTING option for that table.

'That is, it should have the sort symbol in each of the table column and it should get sorted based on the ascending, descending option i choose

How to bring the sorting functionality for each column of the table in WDA

Regards,

Shanthi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi Shanthi,

for table sorting proceed like this :

1 Go to Attributes Tab, Give TABLE_CONTROL in the Attribute Column , Check the Check Box in the RefTo Column & give IF_WD_TABLE_METHOD_HNDL in the Associated Type. .

2 Then create one Event for onSort Event of the Table by Clicking the Create Button .Then Give the Action Name as ON_TEST_SORT .

3 thn bind ur context node to table in WDDOINIT.


data LO_ND_MARA type ref to IF_WD_CONTEXT_NODE.
data LT_TABLE  type WD_THIS->ELEMENTS_NODE.
* Bind Table
  LO_ND_NODE->BIND_TABLE( LT_TABLE ).
here NODE is the name of the node to which table is binded

in ur WD DOMDIFY


..
data wd_table type ref to cl_wd_table.
check first_time = abap_true.
* Name of the table UI element to be provided
wd_table ?= view->get_element( 'TABLE' ).
wd_this->table_control ?= wd_table->_method_handler.
*Name of the key attribute of the context node to which the table binding is done to be  provided
wd_this->table_control->set_key_attribute_name( 'ATTRIBUTE' ). 

HERE ATTRIBUTE is the name of ATTRIBUTE for which u want to apply sorting .

in ur ONACTIONON_TEST_SORT method


..
wd_this->table_control->apply_sorting( ).

I hope it wud solve ur problem

rgds,

amit

Answers (2)

Answers (2)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Perhaps you should consider switching from the Table UI element to the ALV component. The ALV has built-in support for sorting - as well as many other features.

arjun_thakur
Active Contributor
0 Kudos

Hi Shanti,

Refer this [thread|].

I hope it helps.

Regards

Arjun