on 01-05-2009 4:25 PM
Dear Experts,
how can i give the user a chance to sort the data in a table ui element ?
In an ALV i can use a toolbar for this. Is there something like this in web dynpro ?
best regards
René
Edited by: René Hölterling on Jan 5, 2009 5:32 PM
Hi,
This will help you.
1. Go to Attributes Tab of your View , 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 and press Enter.
UI Element-> table->properties->events->onSort.
3. Then go to the Methods Tab
4.Follow the below Code in the Corresponding Methods.
WDDOINIT:
method WDDOINIT .
data LO_ND_MARA type ref to IF_WD_CONTEXT_NODE.
data LO_EL_MARA type ref to IF_WD_CONTEXT_ELEMENT.
data LT_MARA type WD_THIS->ELEMENTS_MARA.
data LS_MARA type WD_THIS->ELEMENT_MARA.
navigate from <CONTEXT> to <MARA> via lead selection
LO_ND_MARA = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_MARA ).
SELECT MATNR MTART MATKL MEINS FROM MARA INTO CORRESPONDING FIELDS OF
TABLE LT_MARA UP TO 10 ROWS WHERE MATNR LIKE 'A%'.
Bind Table
LO_ND_MARA->BIND_TABLE( LT_MARA ).
endmethod.
WDDOMODIFYVIEW:
method WDDOMODIFYVIEW .
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( 'MATNR' ).
endmethod.
ONACTIONON_TEST_SORT:
method ONACTIONON_TEST_SORT .
wd_this->table_control->apply_sorting( ).
endmethod.
For more clear information go to SAPTECHNICAl->Tutorials->Webdynpro
Regards Madhu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi René,
create an event say Sort and bind it with onsort event of your table UI element.....
now you can write below code there
wd_this->table_control->apply_sorting( ).
regards
Pranav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rene,
Please refer to this link:
sort table column(http://saptechnical.com/Tutorials/WebDynproABAP/Sort/tablecolumn.htm)
I hope it helps.
Regards
Arjun
Edited by: Arjun on Jan 6, 2009 9:11 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.