on 2013 Feb 12 6:34 AM
Hello,
I want to enable Multicolsorting working in tablecontrol.I dont want to use webdynpro ALV.
Single column sorting is working. But when i press control and click on second column, sorting is not happening.
Also sorting is considering empty rows in my table control.
has anyone faced a similar problem.
I searched in SDn and couldnt find a matching example/situation.
Please help.
Thanks,
Linda
Request clarification before answering.
Hi,
Just in case you're wondering how to make it work. From my experience, the answer is - you have to develop the multisorting code by yourself. It doesn't seem to be a built in functionality. Enabling multiColSorting property in WebDynpro's View Table definitely allows to have a field MULTIPLE in UI parameters with action onSort. It's abap_true ('X') when the multiple sort is triggered, abap_false (' ') when not. Mentioned by abhinav.sharma as well.
But the usually used in examples method wd_this->table_method_handler->apply_sorting( ), where table_method_handler is of type IF_WD_TABLE_METHOD_HNDL and it's your newly created WebDynpro View attribute, allows you only to sort one column. It won't work when you want to sort more than one column.
Assuming you have already single column sorting work, you can solve this f.ex. by sorting columns dynamically according to TableColumn IDs inside WebDynpro table. To accomplish this, you can use such methods as:
wd_this->table_method_handler->get_all_columns( ) " returns a column table
When iterating at columns table, use:
single_column->get_sort_state( ) " returns which way in WebDynpro table the column is set to be sorted: '00' - ascending, '01' - descending, '02' - none (no sorting applied), which you can use to set a DESCENDING property of sort table used in SORT BY
single_column->get_id( ) " returns associated WebDynpro TableColumn ID from your view, which you can use to fill property NAME of sort table used in SORT BY
Once you've iterated over all these columns, set their names accordingly to your original table and know how a client set them to be sorted (or not), you can simply use your sort table as I did here in this code (this is the base concept, you probably need to modify all lines where the context node table is mentioned and it should work):
https://gist.github.com/TeeKay18/4ec2d7117ea0587d9e66623968d1cf51
PS Getting ID and parsing it probably is not the greatest implementation and requires WebDynpro ColumnTables IDs match in the same recognizable pattern to column names in original table, but when done carefully, it can surely work the way you like. If someone can improve it by directly getting the binded column name corresponding to the original table, feel free to share your method as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
64 | |
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.