cancel
Showing results for 
Search instead for 
Did you mean: 

Table VIew visible First row problem

shiva_suvarna
Participant
0 Kudos

Hi Friends

I fixed a table view in xhtmlb tabstrip that has three states,

In expand state i am displaying 20 rows in table , when ever we select a row it has to display only the selected row in the table view. so i am setting the <b>visible first row</b> to the <b>selected row index</b> and <b>visiblerowcount</b> to <b>1</b> .

but it is displaying the first row of that 20 records. i had set the visiblefirstrow property correctly.

i debugged the application , the value of visiblefirstrow in tableview reference is same as what i set until 'IF_BSP_ELEMENT~DO_AT_END' of "cl_htmlb_tableview" but after this method the value is changing to the first row of that 20 recods.

if any one solves it is pleasure and thanks in advance

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

HI Shiva,

AS i could get it, you are showing some data in a tableview and on selection you want to show just the Row selected.

For this,you have to read the table for the selected row and this you can show in the same tableview after refreshing and purging old data.

For ex:

 <htmlb:tableView id              = "tab1"
                       table           = "<%= itab %>"
                       visibleRowCount = "20"
                       design          = "ALTERNATING"
                       footerVisible   = "TRUE"
                       onRowSelection  = "myEvent"
                       selectionMode="singleSelect">
      </htmlb:tableView>
in onInputProcessing
DATA: tv TYPE REF TO CL_HTMLB_TABLEVIEW.
tv ?= CL_HTMLB_MANAGER=>GET_DATA(
                  request      = runtime->server->request
                  name         = 'tableView'
                  id           = 'tab1' ).
IF tv IS NOT INITIAL.
 DATA: tv_data TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
  tv_data = tv->data.
  IF tv_data->SelectedRowIndex IS NOT INITIAL.
    FIELD-SYMBOLS: <row> LIKE LINE OF itab.
    READ TABLE itab INDEX tv_data->SelectedRowIndex ASSIGNING
<row>.
data:struc like line of itab.
if <row> is not initial.
struc-EMP_NUM  = <row>-EMP_NUM .
struc-name  = <row>-name.
clear itab.
append struc to itab.
endif.
endif.

This will show only the selected row in your tableview.

In your case,if you set visible row count to 1 ,the tableview will display the first record of the data retrieved .

Hope this helps,

Regards,

Siddhartha

shiva_suvarna
Participant
0 Kudos

hello siddartha

here u r refreshing the table , but i dont want to remove the records from Internal table , i just want to set the visiblerowcount , visiblefirstrow properties trhough variables.

If i refresh,then if i want to go back to exapnd mode then i am not able to show the other records.

I am using the xhtmlbpager not the pager of tableview.

Former Member
0 Kudos

hi,

Then maybe you can do some modifications to the code and add other tableview.

ex:


        <%if itab3 is initial.%>
      <htmlb:tableView id              = "tab1"
                       table           = "<%= itab %>"
                       visibleRowCount = "8"
                       design          = "ALTERNATING"
                       footerVisible   = "TRUE"
                       onRowSelection  = "myEvent"
                       selectionMode="singleSelect"
                       visibleFirstRow = "<%=rowselected%>"
                       >
   </htmlb:tableView>
   
 <%endif.%>
   
   <%if itab3 is not initial.%>
   <htmlb:tableView id              = "tab3"
                       table           = "<%= itab3 %>"
                       visibleRowCount = "8"
                       design          = "ALTERNATING"
                       footerVisible   = "TRUE"
                       onRowSelection  = "myEvent"
                       selectionMode="singleSelect"
                       visibleFirstRow = "<%=rowselected%>"
                       >
   </htmlb:tableView>


     <%endif.%>
Also,in your onInputProcessing chnage the lines as

data:struc like line of itab..
if <row> is not initial.
struc-EMP_NUM  = <row>-EMP_NUM .

struc-name  = <row>-name.
*clear itab.

<b>append struc to itab3.</b>
endif.
This way,your original table(itab) will be intact while you will display only the selected row in itab3.
You can get back to original table on expanding.

Regards,
Siddhartha

shiva_suvarna
Participant
0 Kudos

Yes as u said this work

but i have three states in compact state i want to show 5 records , where if user first in expand mode and then he selcected one record if he want to come to compact mode there i want to show 5 records of from the 20 records along with the selcted record and user may be toggle among states i have to display the no of records with corresponding to the state.

Does i need to refresh internal table every time i think it may be possible with 'VISIBLEROWCOUNT' and 'VISIBLEFIRSTROW' properties .