cancel
Showing results for 
Search instead for 
Did you mean: 

TableView visible Rows after event

Former Member
0 Kudos

Hello,

does anyone know a solution for this:

I have a tableview with <i>visibleRowCount = "5"</i>. When I navigate to the next page (or the third one...) in this tableview and afterwards press a button, the tableview shows the first page again in the next screen.

Table events (rowselection f.e.) does not affect the shown page.

A selected row keeps selected when I press the button outside the table but I also really want to keep the page as it was before.

Does anyone know how to do this?

Regards Henry

Accepted Solutions (1)

Accepted Solutions (1)

maximilian_schaufler
Active Contributor
0 Kudos

<htmlb:tableView> also has an attribute named <b>VisibleFirstRow</b>.

As you said, on tableview events this is kept automatically. If you want to keep that value on non-tableview events, this is the way to do:

In DO_HANDLE_EVENT you have can access all the form fields that have been submitted by the browser, one of them will be called something like this:

myTableViewID_VisibleFirstRow

If you have the tableview in a subcontroller, then there would be the subcontroller ID preceding this attribute name.

Here is the code to access the form fields (place in DO_HANDLE_EVENT):


data: fields            type tihttpnvp,
      field             type ihttpnvp,
      myVisibleFirstRow type i.
call method request->get_form_fields_cs
  changing
    fields = fields.
name = `myTableViewID`.
loop at fields into field.
  if field-name eq name.
    myVisibleFirstRow = field-value.
  endif.
endloop.

From there on it should be easy going, just hand over this variable to the view you are calling, define a page attribute there, and add the visibleFirstRow attribute to your <htmlb:tableview> tag.

Also have a look at the complete form_fields table in debug mode, you might find some more interesting fields there - recommended!

Cheers,

Max

Former Member
0 Kudos

As You suggested I used the visibleFirstRow parameter. In DO_HANDLE_EVENT I took the table-class and found out that there is an attribute called visiblefirstrowindex. So the code now looks like this:

<i>

DATA: table TYPE REF TO CL_HTMLB_TABLEVIEW,

table_event TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.

table ?= cl_htmlb_manager=>get_data(

request = request

name = 'tableView'

id = 'oetPositions_tvEptBest'

).

table_event ?= table->data.

model->visiblefirstrow_best = table_event->VISIBLEFIRSTROWINDEX.</i>

Thanks a lot.

Henry

maximilian_schaufler
Active Contributor
0 Kudos

You're welcome

Maybe one thing to add:

when placing code in your forum posts, you can use a special formatting tag - maybe you would have already used it, if it were shown next to the other buttons ...

(code)

  • Place your code here

table_event ?= table->data.

(/code)

If you do that with square brackets instead of the parenthesis ones, the result will look like this:


* Place your code here
table_event ?= table->data.

Answers (0)