on 09-25-2012 7:25 PM
Hello Gurus,
I have created a table and added filter and sort functionality using DEMO_TABLE application.
Filter and sort is working fine as expected. now, i have created a button(BACK) to go back to selection screen to search again with the new selection screen values.
whenever i click on (BACK) button, how can i reset the filter and sort on table.
I'll update the table context when the user clicked on "Search" button on the first view. once the table is updated with the new data, user can able to filter and sort again.
Can anyone please let me know how to reset the filter & sort functionality up on back button action (Second View) or Search button action (First View).
Little urgent! Points will be rewarded!
Thank You.
Shyam
Hi,
You can try the following:
1. Get the reference of your table in the view in method WDDOMODIFYVIEW.
2. Pass this to a global variable.
3. No when the user presses back call method SET_ON_FILTER of class CL_WD_TABLE with your table reference stored in the global variable in step2.
4. Pass space as parameter to this method.
Also do not forget to clear the node that holds filter information.
Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kushboo,
I have written the below logic in WDDOMODIFYVIEW.
DATA: l_table TYPE REF TO cl_wd_table,
l_is_filter_on TYPE wdy_boolean.
* Find out whether filter is on
wd_context->get_attribute( EXPORTING name = 'IS_FILTER_ON'
IMPORTING value = l_is_filter_on ).
* Get reference of the table view element
l_table ?= view->get_element( 'TABLE' ).
* Get reference to the Filter & Sorting API
wd_this->table_control ?= l_table->_method_handler.
* Set or cancel the table's filter action
IF l_is_filter_on = abap_true.
l_table->set_on_filter( 'FILTER' ).
ELSE.
l_table->set_on_filter( '' ).
ENDIF.
If i create a global variable in Component Controller, Can you please let me know what value do i have to pass to the global variable?
I have called the method CL_WD_TABLE->SET_ON_FILTER method in BACK button and set the filter value to space. but it didn't work for me. ( I have invalidated the filter node and table node in BACK button).
Can you please give me some sample code if you have?
Thank You.
Shyam
Hi shyam,
Do the following.
1. Go to the attributes tab of your view and declare a variable L_TABLE. Check the Type Ref To Checkbox. Use type CL_WD_TABLE.
2. Go to your method WDDOMODIFYVIEW. Remove the declaration l_table TYPE REF TO cl_wd_table.
3. Now replace l_table with wd_this->l_table in the code in the method WDDOMODIFYVIEW.
4. Go to the action handler of Back Button and write the following code.
* Invalidate the filter node
DATA: lr_node TYPE REF TO if_wd_context_node.
lr_node = wd_context->get_child_node( 'FILTER' ).
lr_node->invalidate( ).
* Apply Filter again
wd_this->l_table->set_on_filter( '' ).
wd_this->table_control->apply_filter( ).
* Call outbound plug to the first view
wd_this->fire_out_view1_plg( ).
This works. I tried it out myself.
In my case it was that when clicking on the button "clean" the entire screen will be cleaned.
* Resetting the filter option
wd_this->table_method_hndl->apply_filter( ).
DATA lo_nd_node TYPE REF TO if_wd_context_node.
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_filter ). "Filter Node
lo_nd_node->invalidate( ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
in the Filter button toggle event invalidate the FILTER context and then apply the filter again , this will make it to work as intended.
Thx
Phani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.