cancel
Showing results for 
Search instead for 
Did you mean: 

htmlb:tableView Recover the selected row

Former Member
0 Kudos

Hi.

How can I recover the selected row in a internal table, with the htmlb:tableView, in the onInputProcessing?

Thanks very much!

I'm using this sentence in the "layout":

<!-- Visualizamos Línea de selección + tabla interna -->

<htmlb:tableView id = "myTableView"

visibleRowCount = "<%= c_ver_registros %>"

width = "<%= c_ancho_tabla %>"

selectionMode = "SINGLESELECT"

table = "<%= T_TABLA %>" >

</htmlb:tableView>

null

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

thanks, but it not works. It return TABLE_EVENT->PREVSELECTEDROWINDEXTABLE as initial.

I think that it not works by the names of table, but I don't know put it

Can you adapt the code to my tableView? Thanks.

I will see the Monday. My code is:

<htmlb:tableView id = "myTable"

visibleRowCount = "<%= c_ver_registros %>"

width = "<%= c_ancho_tabla %>"

selectionMode = "SINGLESELECT"

selectedRowIndex = "<%= var_selectedindex %>"

table = "<%= T_TABLA %>" >

</htmlb:tableView>

Thanks very much.

I changed your code for my program in:

data: selected_ind TYPE INT4_TABLE.

TV ?= CL_HTMLB_MANAGER=>GET_DATA( REQUEST = REQUEST

NAME = 'tableView' ID = 'myTable' ).

Marcos

raja_thangamani
Active Contributor
0 Kudos

Look at the changes..

          <htmlb:tableView id                    = "myTable"
                           width = "<%= c_ancho_tabla %>"
                           design = "ALTERNATING"
                         visibleRowCount = "<%= c_ver_registros %>"
                           fillUpEmptyRows       = "X"
                          selectedRowIndex = "<%= var_selectedindex %>" Declare var_selectedindex  as Page attribute
                           onRowSelection        = "onRowSelection"
                           selectionMode = "SINGLESELECT"
                           sort                  = "server"
                           table = "<%= T_TABLA %>"  />

Raja T

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanks!

Former Member
0 Kudos

Hi,

you need to declare it as int .I think that is sufficient.

<b>selected_ind type i. </b>

and get the selected value as Raja told:

IF TV IS NOT INITIAL.

TABLE_EVENT = TV->DATA.

CLEAR SELECTED_IND.

SELECTED_IND = TABLE_EVENT-><b>SELECTEDROWINDEX.</b>

ENDIF.

regards,

Bhanu.

raja_thangamani
Active Contributor
0 Kudos

It should be type

selected_ind	TYPE	INT4_TABLE

Raja T

Former Member
0 Kudos

It not works

The line

onRowSelection = "onRowSelection"

does that can't be posible select the row.

And... I think that the problem is the associated type of var_selectedindex in the pages attributes.

What must be this type?

Thanks.

Former Member
0 Kudos

Thanks for reply.

but I have got problems with the declarations.

If I active the code, sap display this error:

"Field HTMLB_EVENT" is unknow. It is neither in one of the specified tables nor defined by a "DATA" stament. "Data stament".

raja_thangamani
Active Contributor
0 Kudos

here you go..

Did u try this code"

selected_ind	TYPE	INT4_TABLE

  DATA: TV          TYPE REF TO CL_HTMLB_TABLEVIEW,
        EVENT       TYPE REF TO CL_HTMLB_EVENT,
        TABLE_EVENT TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
  FIELD-SYMBOLS <I> LIKE LINE OF SELECTED_IND.
 
  TV ?= CL_HTMLB_MANAGER=>GET_DATA( REQUEST = REQUEST
                                    NAME    = 'tableView'
                                    ID      = 'list' ).
  IF TV IS NOT INITIAL.
    TABLE_EVENT = TV->DATA.
    CLEAR  SELECTED_IND.
    SELECTED_IND = TABLE_EVENT->PREVSELECTEDROWINDEXTABLE.
 
  ENDIF.

Raja T

Former Member
0 Kudos

hi Marcos,

While calling the Tableview in the layout get the selected row index in the attribute <b>selectedRowIndex = "<%= var_selectedindex %>"</b> { where var_selectedindex should be defined as a pageattribute} the tableview definition should be like this..

<htmlb:tableView id = "myTableView"

visibleRowCount = "<%= c_ver_registros %>"

width = "<%= c_ancho_tabla %>"

selectionMode = "SINGLESELECT"

<b>selectedRowIndex = "<%= var_selectedindex %>"</b>

table = "<%= T_TABLA %>" >

</htmlb:tableView>

And in the <b>inputprocessing</b> ,

Try this code..

IF htmlb_event IS NOT INITIAL AND htmlb_event->if_htmlb_data~event_name = 'tableView' AND

( htmlb_event->if_htmlb_data~event_type = 'cellClick' OR

htmlb_event->if_htmlb_data~event_type = 'rowSelection' OR

htmlb_event->if_htmlb_data~event_type = 'navigate' ) .

DATA tableview_event TYPE REF TO cl_htmlb_event_tableview.

tableview_event ?= htmlb_event.

IF lr_tableview_event->selectedrowindex IS NOT INITIAL .

var_selectedindex = tableview_event->selectedrowindex.

ENDIF.

ENDIF.

regards,

Bhanu.