cancel
Showing results for 
Search instead for 
Did you mean: 

Jumping back to the first page of the result table after second search

Former Member
0 Kudos

Hi Experts,

i have a search area and a result table, I type a text in inputfield and click on find button. I get the results in a table beneath the search area on the same view. I select some line or lines and turn the page for example to the third page.

By a new search I get the results in the table correctly, but it shows still the third page. If I turn now the page to the first page, I see that the first row is selected automatically which is good but it is not visible automatically.

How can I get back automatically to the first page after a new search.?

Properties of the table context node:

cardinality 0..n

selection 0..n

Initialization Lead Selection -> checked

Initialization Lead Selection: here I tested also the unchecked case. The only difference was the setting of the selection. By unchecked it doesn't set the selection on the first row. You can see no difference by turning the page, it stays also on the last viewed page by the last search.

Layout properties of the table:

I tested "MultiNoLead" and "auto" for the selectionMode and noticed that in both cases, it deletes the last selection (yellow highlighted) from last search process.

The difference here was:

MultiNoLead -> sets no selection on first row and also doesnu2019t jump to the first row

auto -> sets selection on first row but still doesnu2019t jump to the first page

I tried all these Methods below in my search method (find button) before binding the table to the context. I tried each method separately. Still no jumping to the first page automatically.

****************************************************************************
** Show the first row (turn to the first page of table) by new search 
**************************************************************************** 

** deletes the last Lead selection (yellow highligted) 
** selectionMode: MultiNoLead -> sets no selection on first row, doesnu2019t jump to the first row 
** selectionMode: auto -> sets selection on first row but still doesnu2019t jump to the first row 
   
* lo_nd_table_data->SET_LEAD_SELECTION_INDEX( index = 0 ). 
** or 
*  lo_nd_table_data->SET_SELECTED( flag  = '' 
*                           index = 0 ). 
** or 
*  lo_nd_table_data->SET_SELECTED( flag  = 'X' 
*                           index = 0 ). 
** or 
*  lo_nd_table_data->SET_SELECTED( flag  = abap_true 
*                           index = 0 ). 
** or 
*  lo_nd_table_data->move_first( 
*     RECEIVING new_lead_selection = lo_el_table_data ). 
** or 
*  lo_nd_table_data->move_to( 
*     EXPORTING index = 1 
*  RECEIVING  new_lead_selection = lo_el_table_data ). 


****************************************************************** 
* Binding the table to the context 
****************************************************************** 
  lo_nd_table_data->bind_table( 
  new_items = lt_table_data 
  set_initial_elements = abap_true ). 
*  index = 0 ).

As you can see above i tried also to set the index = 0 in the bind_table method but still it doesn't jump to the first page.

Does anyone has an Idea?

Thank you

Regards

Haleh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I have smiler problem, and the only solution I found is to reset the view layout

In method WDDOMODIFYVIEW of the view call view->reset_view( )

You need to do this ONLY after the search is performed, otherwise your layout will reset all the time. If you have any dynamic layout changes, they will be reset as well.

Regards

Kameliya

Former Member
0 Kudos

Hi Kameliya,

thank you for your reply. I am trying to implement the reset_view( ) method in the WDDOMODIFYVIEW of my view.

Would you please tell me how achieve this, that the reset method in the WDDOMODIFYVIEW only will be executed after the search method is performed?

Thanks and regards

Haleh

Former Member
0 Kudos

Hi Haleh,

Create a value in the context or as controller atribute , then set it in your action method. Then in your WDDOMODIFYVIEW check the value if it is the same as expected and clear it.

      • In WDDOMODIFYVIEW

IF wd_this->reset = 'X'.

view->reset_view( ).

CLEAR wd_this->reset.

ENDIF.

      • In your action method

wd_this->reset = 'X'.

Regards

Kameliya

Former Member
0 Kudos

Hi Kamelyia,

this is greate. That was the right answer. I did it and it works properly. ))))

thank you very much for your help.

Regards

Haleh

Answers (1)

Answers (1)

Former Member
0 Kudos

I Presume, third page is a separate view. There are two options:

1. Set the life time of the view to "When Visible" instead of framework controlled

2. Invalidate the node when you navigate back to first page.

Regards

Rohit Chowdhary

Former Member
0 Kudos

Hi Rohit,

thank you for your answer. Due to the options you wrote:

- all of my UI elements are on a view. I turn the page with the icons on the footer of the table.

- I validate the table node at the beginning of the search method (find button).

Did I understand you rught?

Regards, Haleh